diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2b47ee7..c5c12a9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,12 @@ This document records all notable changes to This project adheres to `PEP 440 -- Version Identification and Dependency Specification `_. +0.4.3 (22-08-03) +---------------- +- Spectrum and Hsi now moved to **data.spectra**. **This could break your fork if you have custom code.** +- LazyHDF5 now within CRIkit2 instead of external library +- Import macrostage raster images (NIST) from multiple datasets + 0.4.2 (22-03-24) ---------------- - Changes to Phase Error Correction UI and some quality of life improvements diff --git a/README.rst b/README.rst index 23255b3..a3db3e5 100644 --- a/README.rst +++ b/README.rst @@ -73,8 +73,6 @@ packages may work. - PyQT5 - CVXOPT -- LazyHDF5 >= 0.2.2 - - Requires H5Py (>= 2.6) - SciPlot-PyQt >= 0.2.2 diff --git a/appveyor.yml b/appveyor.yml index 63aeb90..f7ae504 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ environment: MINICONDA_VERSION: "latest" PYTHON_ARCH: "64" CONDA_DEPENDENCIES: "numpy scipy pyqt matplotlib h5py cvxopt" - PIP_DEPENDENCIES: "pytest pytest-cov codecov lazyhdf5" + PIP_DEPENDENCIES: "pytest pytest-cov codecov" matrix: - PYTHON_VERSION: "3.7" diff --git a/crikit/CRIkitUI.py b/crikit/CRIkitUI.py index 2e5c43a..a7755da 100644 --- a/crikit/CRIkitUI.py +++ b/crikit/CRIkitUI.py @@ -60,14 +60,14 @@ from crikit.data.frequency import (calib_pix_wn as _calib_pix_wn, calib_pix_wl as _calib_pix_wl) -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.data.spectra import Spectra -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.datasets.model import Model as _Model from crikit.io.macros import import_csv_nist_special1 as io_nist_dlm -from crikit.io.macros import import_hdf_nist_special as io_nist +from crikit.io.macros import (import_hdf_nist_special as io_nist, hdf_nist_special_macroraster as io_nist_macro) from crikit.io.macros import import_hdf_nist_special_ooc as io_nist_ooc # from crikit.io.meta_configs import special_nist_bcars2 as _snb2 @@ -113,14 +113,14 @@ from sciplot.sciplotUI import SciPlotUI as _SciPlotUI -import lazy5 -from lazy5.ui.QtHdfLoad import HdfLoad +from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad +import crikit.io.lazy5 as lazy5 force_not_sw = False try: import crikit2_sw -except: +except Exception: __sw_installed = False # print('SW package not installed, using standard') from crikit.ui.dialog_SVD import DialogSVD @@ -143,7 +143,7 @@ try: from crikit.ui.widget_Jupyter import QJupyterWidget jupyter_flag = 1 -except: +except Exception: print('No appropriate Jupyter/IPython installation found. Console will not be available') jupyter_flag = -1 @@ -228,7 +228,7 @@ def __init__(self, **kwargs): self.ui.sweeperVL.insertWidget(0, self.img_BW, stretch=1, alignment=_QtCore.Qt.AlignHCenter) try: self.img_BW.mpl.fig.tight_layout(pad=2) - except: + except Exception: print('tight_layout failed (CrikitUI: 1') # ID used for matplotlib to connect to a figure @@ -290,6 +290,7 @@ def __init__(self, **kwargs): # Load Data self.ui.actionOpenHDFNIST.triggered.connect(self.fileOpenHDFNIST) self.ui.actionOpenHDFNISTOOC.triggered.connect(self.fileOpenHDFNISTOOC) + self.ui.actionOpen_HDF_Macro_Raster_NIST.triggered.connect(self.fileOpenHDFMacroRasterNIST) self.ui.actionLoadNRB.triggered.connect(self.loadNRB) self.ui.actionLoadDark.triggered.connect(self.loadDark) @@ -422,7 +423,7 @@ def __init__(self, **kwargs): try: str_banner = 'Welcome to the embedded ipython console\n\n' self.jupyterConsole = QJupyterWidget(customBanner=str_banner) - except: + except Exception: print('Error loading embedded IPython Notebook') else: self.ui.tabMain.addTab(self.jupyterConsole, 'Jupyter/IPython Console') @@ -455,7 +456,7 @@ def __init__(self, **kwargs): if temp is not None: try: self.fileOpenSuccess(True) - except: + except Exception: print('Error in input hsi') self.hsi = Hsi() @@ -466,7 +467,7 @@ def __init__(self, **kwargs): self.hsi.x = temp self.hsi._x_rep.units = kwargs.get('x_units') self.hsi._x_rep.label = kwargs.get('x_label') - except: + except Exception: print('Error in input x-array') self.hsi.x = None @@ -477,7 +478,7 @@ def __init__(self, **kwargs): self.hsi.y = temp self.hsi._y_rep.units = kwargs.get('y_units') self.hsi._y_rep.label = kwargs.get('y_label') - except: + except Exception: print('Error in input y-array') self.hsi.y = None @@ -488,7 +489,7 @@ def __init__(self, **kwargs): self.hsi.freq._data = temp self.hsi.freq._units = kwargs.get('f_units') self.hsi.freq._label = kwargs.get('f_label') - except: + except Exception: print('Error in input freq-array (f)') self.hsi.freq._data = None @@ -498,7 +499,7 @@ def __init__(self, **kwargs): self.hsi.data = kwargs.get('data') self.hsi.check() self.fileOpenSuccess(True) - except: + except Exception: print('Error in input data') self.hsi = Hsi() @@ -645,7 +646,7 @@ def closeEvent(self, event): for count in self.bcpre.cut_list: try: _os.remove(count + '.pickle') - except: + except Exception: print('Error in deleting old pickle files') else: del_flag += 1 @@ -658,11 +659,54 @@ def closeEvent(self, event): print('Closing HDF File') try: self.fid.close() - except: + except Exception: print('Something failed in closing the file') else: print('Successfully closed HDF File') + def fileOpenHDFMacroRasterNIST(self, *args, dialog=True): + """ + Open and load multiple datasets from HDF file that describe a single image. + Used for a macrostage rastering mode at NIST. + + dialog : bool + Present a gui for file and dataset selection + """ + + # Get data and load into CRI_HSI class + # This will need to change to accomodate multiple-file selection + + if dialog: + try: + if (self.filename is not None) & (self.path is not None): + to_open = HdfLoad.getFileDataSets(_os.path.join(self.path, self.filename), parent=self, title='Hyperspectral Image') + else: + to_open = HdfLoad.getFileDataSets(self.path, parent=self, title='Hyperspectral Image') + + print('to_open: {}'.format(to_open)) + if to_open is not None: + self.path, self.filename, self.dataset_name = to_open + except Exception as e: + _traceback.print_exc(limit=1) + print('Could not open file. Corrupt or not appropriate file format: {}'.format(e)) + else: + if to_open is not None: + self.hsi = Hsi() + print('Path: {}'.format(self.path)) + print('filename: {}'.format(self.filename)) + print('dset name: {}'.format(self.dataset_name)) + success = io_nist_macro(self.path, self.filename, self.dataset_name, + self.hsi) + print('Was successful: {}'.format(success)) + print('HSI shape: {}'.format(self.hsi.shape)) + print('Succes: {}'.format(success)) + self.fileOpenSuccess(success) + else: + self.hsi = Hsi() + success = io_nist_macro(self.path, self.filename, self.dataset_name, + self.hsi) + self.fileOpenSuccess(success) + def fileOpenHDFNIST(self, *args, dialog=True): """ Open and load HDF5 File @@ -725,7 +769,7 @@ def fileOpenHDFNISTOOC(self, *args): if to_open is not None: self.path, self.filename, self.dataset_name = to_open self.dataset_name = self.dataset_name[0] - except: + except Exception: print('Could not open file. Corrupt or not appropriate file format.') else: if to_open is not None: @@ -774,9 +818,9 @@ def fileOpenSuccess(self, success): """ if success: # * If HSI is integer dtype, convert to float - if (self.hsi.data.dtype.kind == 'i') & isinstance(self.hsi.data, _np.ndarray): + if (self.hsi.data.dtype.kind in ['i','u']) & isinstance(self.hsi.data, _np.ndarray): print('Converting HSI from int to float') - self.hsi.data = 1.0*self.hsi.data + self.hsi.data = 1.0 * self.hsi.data self.setWindowTitle('{}: {}'.format(self.windowTitle(), self.filename)) # FILE @@ -940,7 +984,7 @@ def fileOpenSuccess(self, success): # signal then reconnect (or could have ignored, but this is easier) try: rgb_img.popimage.ui.pushButtonSpectrum.pressed.disconnect() - except: + except Exception: pass rgb_img.popimage.ui.pushButtonSpectrum.pressed.connect(self.spectrumColorImg) @@ -975,7 +1019,7 @@ def loadDark(self): if success: # If Dark is integer dtype, convert to float - if self.dark.data.dtype.kind == 'i': + if self.dark.data.dtype.kind in ['u', 'i']: print('Converting Dark from int to float') self.dark.data = 1.0*self.dark.data @@ -1020,7 +1064,7 @@ def loadDarkDLM(self): if success: # If Dark is integer dtype, convert to float - if self.dark.data.dtype.kind == 'i': + if self.dark.data.dtype.kind in ['u', 'i']: print('Converting Dark from int to float') self.dark.data = 1.0*self.dark.data @@ -1064,7 +1108,7 @@ def loadNRB(self): success = io_nist(pth, filename, datasets, nrb) if success: # If NRB is integer dtype, convert to float - if nrb.data.dtype.kind == 'i': + if nrb.data.dtype.kind in ['u', 'i']: print('Converting NRB from int to float') nrb.data = 1.0*nrb.data @@ -1199,7 +1243,7 @@ def showPreviewRois(self): self.img_BW.mpl.ax.add_artist(lg) try: self.img_BW.mpl.fig.tight_layout(pad=1) - except: + except Exception: print('tight_layout failed (CrikitUI: 2') self.img_BW.mpl.draw() @@ -1611,7 +1655,7 @@ def _roiSubtract(self, locs): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -1987,7 +2031,7 @@ def lineEditFreqChanged(self): self.ui.freqSlider.setSliderPosition(pos) self.changeSlider() - except: + except Exception: pass def lineEditPixChanged(self): @@ -2060,7 +2104,7 @@ def opChange(self): try: currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxOperations.currentText() self.img_RGB_list[rgbnum].data.operation = currentop - except: + except Exception: pass def condOpChange(self): @@ -2072,7 +2116,7 @@ def condOpChange(self): try: currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxCondOps.currentText() self.img_RGB_list[rgbnum].data.condoperation = currentop - except: + except Exception: pass def condInEqualityChange(self): @@ -2084,7 +2128,7 @@ def condInEqualityChange(self): try: currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxCondInEquality.currentText() self.img_RGB_list[rgbnum].data.inequality = currentop - except: + except Exception: pass def spinBoxInEqualityChange(self): @@ -2096,7 +2140,7 @@ def spinBoxInEqualityChange(self): try: self.img_RGB_list[rgbnum].data.inequalityval = \ self.img_RGB_list[rgbnum].math.ui.spinBoxInEquality.value() - except: + except Exception: pass def doKK(self): @@ -2122,7 +2166,7 @@ def doKK(self): conj = True else: conj = False - except: + except Exception: conj = False out = DialogKKOptions.dialogKKOptions(data=[self.hsi.f, @@ -2166,7 +2210,7 @@ def doKK(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2267,7 +2311,7 @@ def deNoise(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2338,7 +2382,7 @@ def errorCorrectPhase(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2384,7 +2428,7 @@ def errorCorrectScale(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2459,7 +2503,7 @@ def errorCorrectAmp(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2479,7 +2523,7 @@ def doUndo(self): for count in self.bcpre.cut_list: try: _os.remove(count + '.pickle') - except: + except Exception: print('Error in deleting old pickle files') else: del_flag += 1 @@ -2525,7 +2569,7 @@ def subDark(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2660,7 +2704,7 @@ def subResidual(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2701,7 +2745,7 @@ def anscombe(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -2733,7 +2777,7 @@ def inverseAnscombe(self): if self.ui.actionUndo_Backup_Enabled.isChecked(): try: _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1]) - except: + except Exception: print('Error in pickle backup (Undo functionality)') else: self.bcpre.backed_up() @@ -3016,7 +3060,7 @@ def setOpFreq1(self): self.img_RGB_list[rgbnum].mpl.draw() - except: + except Exception: print('Error') self.doComposite() @@ -3031,7 +3075,7 @@ def setOpFreq2(self): self.img_RGB_list[rgbnum].data.opfreq2 = currentfreq self.img_RGB_list[rgbnum].math.ui.pushButtonOpFreq2.setText(str(round(currentfreq, 1))) - except: + except Exception: pass def setOpFreq3(self): @@ -3046,7 +3090,7 @@ def setOpFreq3(self): self.img_RGB_list[rgbnum].data.opfreq3 = currentfreq self.img_RGB_list[rgbnum].math.ui.pushButtonOpFreq3.setText(str(round(currentfreq, 1))) - except: + except Exception: pass def setCondFreq1(self): @@ -3061,7 +3105,7 @@ def setCondFreq1(self): self.img_RGB_list[rgbnum].data.condfreq1 = currentfreq self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq1.setText(str(round(currentfreq, 1))) - except: + except Exception: print('Error') def setCondFreq2(self): @@ -3076,7 +3120,7 @@ def setCondFreq2(self): self.img_RGB_list[rgbnum].data.condfreq2 = currentfreq self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq2.setText(str(round(currentfreq, 1))) - except: + except Exception: print('Error') def setCondFreq3(self): @@ -3091,7 +3135,7 @@ def setCondFreq3(self): self.img_RGB_list[rgbnum].data.condfreq3 = currentfreq self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq3.setText(str(round(currentfreq, 1))) - except: + except Exception: print('Error') def spectrumColorImg(self): @@ -3114,7 +3158,7 @@ def spectrumColorImg(self): else: Mask = Mask > 0 - Mask = Mask.astype(_np.integer) + Mask = Mask.astype(_np.int32) mask_hits = Mask.sum() @@ -3256,7 +3300,7 @@ def changeSlider(self): if self._mpl_v1: self.img_BW.mpl.ax.hold(True) - except: + except Exception: print('Error in changeSlider: display img_BW') try: @@ -3298,11 +3342,11 @@ def changeSlider(self): self.img_BW.mpl.ax.add_artist(lg) try: self.img_BW.mpl.fig.tight_layout(pad=1) - except: + except Exception: print('tight_layout failed (CrikitUI: 3') - except: + except Exception: print('Error in showing overlay legend') - except: + except Exception: print('Error in changeSlider: display overlays') self.img_BW.mpl.draw() @@ -3378,7 +3422,7 @@ def doComposite(self): yunits=self.img_Composite2.data.yunits, extent=self.img_BW.data.winextent) self.img_Composite2.mpl.draw() - except: + except Exception: print('Error in doComposite') def updateOverlays(self): @@ -3663,7 +3707,7 @@ def specialDemosaicRGB(self): img_shape = fid[dataset_name].shape self._mosaic_mask = _np.zeros(img_shape) fid[dataset_name].read_direct(self._mosaic_mask) - n_imgs = self._mosaic_mask.max().astype(_np.int) + n_imgs = self._mosaic_mask.max().astype(int) fid.close() msg = _QMessageBox(self) @@ -3710,7 +3754,7 @@ def crikit_launch(**kwargs): Input kwargs (Optional) ------------------------ - hsi : crikit.data.Hsi + hsi : crikit.data.spectra.Hsi Hsi instance data : ndarray (3D) diff --git a/crikit/__init__.py b/crikit/__init__.py index 205dfca..52349c9 100644 --- a/crikit/__init__.py +++ b/crikit/__init__.py @@ -14,4 +14,4 @@ * Charles H. Camp Jr. """ -__version__ = '0.4.2' \ No newline at end of file +__version__ = '0.4.3' diff --git a/crikit/cri/algorithms/kk.py b/crikit/cri/algorithms/kk.py index e53296f..aaeeb4f 100644 --- a/crikit/cri/algorithms/kk.py +++ b/crikit/cri/algorithms/kk.py @@ -96,7 +96,7 @@ def kkrelation(bg, cri, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad ratio[ratio <= 0] = bad_value if (ratio.ndim == 3) & ((axis == -1) | (axis == 2)) & (not no_iter): - ph = _np.zeros(ratio.shape, dtype = _np.complex) + ph = _np.zeros(ratio.shape, dtype = complex) for num in range(ratio.shape[0]): ph[num, ...] = _np.exp(1j * (hilbertfft(0.5 * _np.log(ratio[num, ...]), **hilb_kwargs) + phase_offset)) else: diff --git a/crikit/cri/error_correction.py b/crikit/cri/error_correction.py index 0266cf1..d881ff9 100644 --- a/crikit/cri/error_correction.py +++ b/crikit/cri/error_correction.py @@ -158,7 +158,7 @@ def _calc(self, data, ret_obj, **kwargs): # else: ret_obj[idx][..., self.rng] *= correction_factor counter += 1 - except: + except Exception: return False else: # print(self._inst_als.__dict__) @@ -227,7 +227,7 @@ def _calc(self, data, ret_obj): ret_obj *= correction_factor else: ret_obj[..., self.rng] *= correction_factor - except: + except Exception: return False else: return True diff --git a/crikit/cri/kk.py b/crikit/cri/kk.py index 71f8920..bcea1db 100644 --- a/crikit/cri/kk.py +++ b/crikit/cri/kk.py @@ -196,12 +196,12 @@ def calculate(self, cars, nrb): Nonresonant background (NRB) """ - kkd = _np.zeros(cars.shape, dtype=_np.complex) + kkd = _np.zeros(cars.shape, dtype=complex) self._calc(cars, nrb, ret_obj=kkd) return kkd def _transform(self, cars, nrb): - if issubclass(cars.dtype.type, _np.complex): + if issubclass(cars.dtype.type, complex): success = self._calc(cars, nrb, ret_obj=cars) return success else: @@ -210,9 +210,9 @@ def _transform(self, cars, nrb): if __name__ == '__main__': # pragma: no cover - from crikit.data.spectrum import Spectrum as _Spectrum + from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi hsi = _Hsi() nrb = _Spectra() diff --git a/crikit/cri/merge_nrbs.py b/crikit/cri/merge_nrbs.py index 28ef486..ad2cb92 100644 --- a/crikit/cri/merge_nrbs.py +++ b/crikit/cri/merge_nrbs.py @@ -74,7 +74,7 @@ def _calc(self, data, ret_obj): else: raise ValueError('self.scale_left must be True, False, or None') - except: + except Exception: return False else: return True diff --git a/crikit/cri/tests/test_kk.py b/crikit/cri/tests/test_kk.py index 1d26385..a200046 100644 --- a/crikit/cri/tests/test_kk.py +++ b/crikit/cri/tests/test_kk.py @@ -47,7 +47,7 @@ def test_kk_rng(): def test_kk_transform(): x = np.linspace(-100, 100, 1000) y = 2/(2**2 + x**2) - y_complex = y.astype(np.complex) + y_complex = y.astype(complex) kk = KramersKronig(norm_to_nrb=False) success = kk._transform(y_complex, 0*y_complex + 1) @@ -58,7 +58,7 @@ def test_kk_transform(): def test_kk_transform_fail(): x = np.linspace(-100, 100, 1000) y = 2/(2**2 + x**2) - y_complex = y.astype(np.complex) + y_complex = y.astype(complex) kk = KramersKronig(norm_to_nrb=False) diff --git a/crikit/data/factorized.py b/crikit/data/factorized.py index 00a99e1..4923488 100644 --- a/crikit/data/factorized.py +++ b/crikit/data/factorized.py @@ -9,10 +9,10 @@ import numpy as _np from crikit.data.frequency import Frequency as _Frequency -from crikit.data.spectrum import Spectrum as _Spectrum +from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra from crikit.data.replicate import Replicate as _Replicate -from crikit.data.hsi import Hsi as _Hsi +from crikit.data.spectra import Hsi as _Hsi class _Factorized: """ diff --git a/crikit/data/hsi.py b/crikit/data/hsi.py deleted file mode 100644 index 50b5863..0000000 --- a/crikit/data/hsi.py +++ /dev/null @@ -1,373 +0,0 @@ -""" -Hyperspectral imagery (hsi) class - -Created on Tue Apr 12 13:06:30 2016 - -@author: chc -""" - -import numpy as _np -import copy as _copy - -from crikit.data.frequency import Frequency as _Frequency -from crikit.data.spectrum import Spectrum as _Spectrum -from crikit.data.replicate import Replicate as _Replicate - -__all__ = ['Hsi'] - -class Hsi(_Spectrum): - """ - Hyperspectral imagery class - - Parameters - ---------- - data : 3D ndarray [y_pix, x_pix, f_pix] - HSI image - - mask : 3D ndarray (int) [y_pix, x_pix, f_pix] - 0,1 mask with 1 is a usable pixel and 0 is not - - freq : crikit.data.frequency.Frequency instance - Frequency [wavelength, wavenumber] object (i.e., the independent \ - variable) - - label : str - Image label (i.e., a string describing what the image is) - - units : str - Units of image (e.g., intensity) - - x_rep : crikit.data.replicate.Replicate instance, Not implemented yet - x-axis spatial object - - y_rep : crikit.data.replicate.Replicate instance, Not implemented yet - x-axis spatial object - - x : 1D ndarray - x-axis spatial vector - - y : 1D ndarray - y-axis spatial vector - - meta : dict - Meta-data dictionary - - Attributes - ---------- - shape : tuple, read-only - Shape of data - - size : int, read-only - Size of data (i.e., total number of entries) - - Methods - ------- - mean : 1D ndarray - Mean spectrum. If extent [a,b] is provided, calculate mean over that\ - inclusive region. - - std : 1D ndarray - Standard deviation of spectrum. If extent [a,b] is provided, calculate standard\ - deviation over that inclusive region. - - subtract : 3D ndarray or None - Subtract spectrum or object - - Notes - ----- - * freq object contains some useful parameters such as op_range_* and \ - plot_range_*, which define spectral regions-of-interest. (It's debatable \ - as to whether those parameters should be in Frequency or Spectrum classes) - - """ - - # Configurations - config = {} - config['nd_axis'] = -1 - - def __init__(self, data=None, freq=None, x=None, y=None, x_rep=None, - y_rep=None, label=None, units=None, meta=None): - - super().__init__(data, freq, label, units, meta) - self._x_rep = _Replicate() - self._y_rep = _Replicate() - self._mask = None - - self._x_rep = _Replicate(data=x) - self._y_rep = _Replicate(data=y) - - if x is None and x_rep is not None: - self.x_rep = _copy.deepcopy(x_rep) - if y is None and y_rep is not None: - self.y_rep = _copy.deepcopy(y_rep) - - @staticmethod - def _mean_axes(*args, **kwargs): - """ Inhereted from Spectrum """ - raise NotImplementedError('Only applicable to Spectrum class.') - - @staticmethod - def _reshape_axes(shape, spectral_axis): - """ - Parameters - ---------- - shape : tuple - Input data shape - - spectral_axis : int - Spectral axis - - Returns - ------- - Reshape vector - """ - ndim = len(shape) - - if ndim == 1: - out = [1, 1, 1] - out[spectral_axis] = shape[0] - elif ndim == 2: # ! Super-wonky - out = [1, shape[0], shape[1]] - elif ndim == 3: - out = shape - elif ndim > 3: - out = [-1, shape[-2], shape[-1]] - else: - raise ValueError('Shape error') - - return tuple(out) - - @property - def mask(self): - return self._mask - - @property - def x_rep(self): - return self._x_rep - - @x_rep.setter - def x_rep(self, value): - if isinstance(value, _Replicate): - self._x_rep = value - elif isinstance(value, _np.ndarray): - self._x_rep.data = value - - @property - def y_rep(self): - return self._y_rep - - @property - def x(self): - return self._x_rep.data - - @x.setter - def x(self, value): - self._x_rep.data = value - - @property - def y(self): - return self._y_rep.data - - @y.setter - def y(self, value): - self._y_rep.data = value - - - @y_rep.setter - def y_rep(self, value): - if isinstance(value, _Replicate): - self._y_rep = value - elif isinstance(value, _np.ndarray): - self._y_rep.data = value - - @property - def data(self): - return self._data - - @data.setter - def data(self, value): - if not isinstance(value, _np.ndarray): - raise TypeError('data must be of type ndarray, not {}'.format(type(value))) - - ax_rs = self._reshape_axes(value.shape, self.config['nd_axis']) - - # self._mask = _np.ones(tuple([n for n in range(3) if n != self.config['nd_axis']]), - # dtype=_np.int) - - if self.freq is None or self.freq.op_list_pix is None: - self._data = value.reshape(ax_rs) - else: - if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: - temp = _np.zeros((self._data.shape),dtype=value.dtype) - temp[:,:,self.freq.op_range_pix] = value.reshape(ax_rs) - self._data = 1*temp - del temp - elif value.shape[self.config['nd_axis']] == self._data.shape[self.config['nd_axis']]: - temp = _np.zeros((self._data.shape),dtype=value.dtype) - temp[..., self.freq.op_range_pix] = value.reshape(ax_rs)[..., self.freq.op_range_pix] - self._data = 1*temp - del temp - - def check(self): - """ - Check x, y, and freq to make sure the dimensions agree with data - """ - if self._data is None: - print('Hsi check: data is None, not checking') - else: - if self._x_rep._data is None: - self._x_rep._data = _np.arange(self.shape[1]) - self._x_rep._label = 'X' - self._x_rep._units = 'pix' - print('Hsi check: setting x to pixels') - elif self._x_rep._data.size != self._data.shape[1]: - self._x_rep = _Replicate() - self._x_rep._data = _np.arange(self.shape[1]) - self._x_rep._label = 'X' - self._x_rep._units = 'pix' - print('Hsi check: setting x to pixels') - - if self._y_rep._data is None: - self._y_rep._data = _np.arange(self.shape[0]) - self._y_rep._label = 'Y' - self._y_rep._units = 'pix' - print('Hsi check: setting y to pixels') - elif self._y_rep._data.size != self._data.shape[0]: - self._y_rep = _Replicate() - self._y_rep._data = _np.arange(self.shape[0]) - self._y_rep._label = 'Y' - self._y_rep._units = 'pix' - print('Hsi check: setting y to pixels') - - if self.freq._data is None: - self.freq._data = _np.arange(self.shape[-1]) - self.freq._label = 'Frequency' - self.freq._units = 'pix' - print('Hsi check: setting freq to pixels') - elif self.freq._data.size != self._data.shape[-1]: - self.freq = _Frequency() - self.freq._data = _np.arange(self.shape[-1]) - print('Hsi check: setting freq to pixels') - return None - - def subtract(self, spectra, overwrite=True): - """ - Subtract spectrum from data - """ - # Order IS important - if isinstance(spectra, Hsi): - if overwrite: - self.data -= spectra.data - return None - else: - return self.data - spectra.data - elif isinstance(spectra, _Spectrum): - if overwrite: - self.data -= spectra.data[None,None,:] - return None - else: - return self.data - spectra.data - elif isinstance(spectra, _np.ndarray): - if spectra.shape == self.data.shape: - if overwrite: - self.data -= spectra - return None - else: - return self.data - spectra - else: - if overwrite: - self.data -= spectra[None,None,:] - return None - else: - return self.data - spectra[None,None,:] - - def get_rand_spectra(self, num, pt_sz=1, quads=False, full=False): - - mlen, nlen, freqlen = self.data.shape - - if quads: - num_spectra = num + 5 - else: - num_spectra = num - - if _np.iscomplexobj(self.data): - dtype = _np.complex - else: - dtype = _np.float - - temp = _np.zeros((num_spectra, self.data.shape[-1]), dtype=dtype) - - quad_mid_row = int(_np.round(mlen/2)) - quad_mid_col = int(_np.round(nlen/2)) - center_row = (int(_np.round(mlen/3)), int(_np.round(2*mlen/3))) - center_col = (int(_np.round(nlen/3)), int(_np.round(2*nlen/3))) - - start_count = 0 - if quads: - # QUADS - # Bottom-left - temp[0, :] = _np.mean(self.data[0:quad_mid_row, 0:quad_mid_col, :], axis=(0, 1)) - - # Upper-left - temp[1, :] = _np.mean(self.data[0:quad_mid_row, quad_mid_col+1::, :], axis=(0, 1)) - - # Upper-right - temp[2, :] = _np.mean(self.data[quad_mid_row+1::, quad_mid_col+1::, :], axis=(0, 1)) - - # Bottom-right - temp[3, :] = _np.mean(self.data[quad_mid_row+1::, 0:quad_mid_col, :], axis=(0, 1)) - - # Center - temp[4, :] = _np.mean(self.data[center_row[0]:center_row[1], center_col[0]:center_col[1], :], axis=(0, 1)) - - start_count += 5 - else: - pass - - rand_rows = ((mlen-pt_sz-1)*_np.random.rand(num_spectra)).astype(int) - rand_cols = ((nlen-pt_sz-1)*_np.random.rand(num_spectra)).astype(int) - - for count in _np.arange(start_count,num_spectra): - if pt_sz == 1: - temp[count, :] = _np.squeeze(self.data[rand_rows[count-start_count], - rand_cols[count-start_count]]) - else: - - rows = [rand_rows[count-start_count]-(pt_sz-1), - rand_rows[count-start_count]+pt_sz] - cols = [rand_cols[count-start_count]-(pt_sz-1), - rand_cols[count-start_count]+pt_sz] - - if rows[0] < 0: - rows[0] = 0 - if rows[1] >= mlen: - rows[1] = mlen-1 - if cols[0] < 0: - cols[0] = 0 - if cols[1] >= nlen: - cols[1] = nlen-1 - - if cols[0] == cols[1] or rows[0] == rows[1]: - pass - else: - temp[count,:] = _np.squeeze(_np.mean(self.data[rows[0]:rows[1], cols[0]:cols[1], :], axis=(0, 1))) - - if (not full) and (self.freq.data is not None): - temp = temp[..., self.freq.op_range_pix] - - return temp - - def __sub__(self, spectrum): - return self.subtract(spectrum, overwrite=False) - -if __name__ == '__main__': # pragma: no cover - - x = _np.linspace(0,100,10) - y = _np.linspace(0,100,10) - freq = _np.arange(20) - data = _np.random.rand(10,10,20) - - - hs = Hsi(data=data, freq=freq, x=x, y=y) - print(hs.shape) - print(isinstance(hs, _Spectrum)) diff --git a/crikit/data/mosaic.py b/crikit/data/mosaic.py index 747b8da..ba8107c 100644 --- a/crikit/data/mosaic.py +++ b/crikit/data/mosaic.py @@ -121,11 +121,11 @@ def dtype(self): dt = [q.dtype.kind for q in self._data] if dt.count('c') > 0: - return _np.complex + return complex elif dt.count('f') > 0: - return _np.float + return float elif dt.count('i') > 0: - return _np.int + return int def mosaic_shape(self, shape=None, idx=None): @@ -248,7 +248,7 @@ def _mosaic(self, shape=None, idx=None, out=None, mask=False): data = sub_img_counter * \ _np.ones(self._data[sub_img_counter][slice_sub_r, slice_sub_c].shape[0:2], - dtype=_np.int) + dtype=int) elif idx is None: data = self._data[sub_img_counter][slice_sub_r, slice_sub_c] else: @@ -348,7 +348,7 @@ def mosaicfull(self, shape=None, out=None): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == _np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) diff --git a/crikit/data/spectra.py b/crikit/data/spectra.py index 3d15340..41a3ebd 100644 --- a/crikit/data/spectra.py +++ b/crikit/data/spectra.py @@ -8,12 +8,733 @@ import copy as _copy from crikit.data.frequency import Frequency as _Frequency -from crikit.data.spectrum import Spectrum as _Spectrum from crikit.data.replicate import Replicate as _Replicate -__all__ = ['Spectra'] +__all__ = ['Spectrum', 'Spectra', 'Hsi'] + + +class Spectrum: + """ + Spectrum class + + Attributes + ---------- + data : 1D ndarray [f_pix] + Spectrum + + freq : crikit.data.Frequency instance + Frequency [wavelength, wavenumber] object (i.e., the independent \ + variable) + + label : str + Spectrum label (i.e., a string describing what the spectrum is) + + units : str + Units of spectrum + + meta : dict + Meta-data dictionary + + f_pix : int, read-only + Size of data. Note: this matches the size of data and does NOT check \ + the size of freq.freq_vec. + + ndim : int, read-only + Number of data dimensions + + shape : tuple, read-only + Shape of data + + size : int, read-only + Size of data (i.e., total number of entries) + + Methods + ------- + mean : int + Mean value. If extent [a,b] is provided, calculate mean over that\ + inclusive region. + + std : int + Standard deviation. If extent [a,b] is provided, calculate standard\ + deviation over that inclusive region. + + subtract : 1D ndarray or None + Subtract spectrum or object + + Notes + ----- + * freq object contains some useful parameters such as op_range* and \ + plot_range*, which define spectral regions-of-interest. (It's debatable \ + as to whether those parameters should be in Frequency or Spectrum classes) + + """ + + # Configurations + config = {} + config['nd_axis'] = -1 + config['nd_fcn'] = _np.mean + + def __init__(self, data=None, freq=None, label=None, units=None, meta=None): + + self._data = None + self._freq = _Frequency() + self._label = None + self._units = None + self._meta = {} + + if data is not None: + self.data = _copy.deepcopy(data) + if freq is not None: + self.freq = _copy.deepcopy(freq) + else: + self.freq = _Frequency() + if label is not None: + self.label = _copy.deepcopy(label) + if units is not None: + self.units = _copy.deepcopy(units) + if meta is not None: + self._meta = _copy.deepcopy(meta) + + @staticmethod + def _mean_axes(ndim, axis): + """ + Parameters + ---------- + ndim : int + Number of dimensions of input data (target is 1D spectrum) + + axis : int + For ND data, axis is remaining axis + + Returns + ------- + Vector that describes what axes to operate (using a mean or similar method) with + axis parameter + """ + if axis < 0: + axis2 = ndim + axis + else: + axis2 = axis + return tuple([n for n in range(ndim) if n != axis2]) + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, _np.ndarray): + raise TypeError('data must be of type ndarray') + + # If sub-range of operation is defined. Only perform action over op_range_pix + if self.freq is not None and self.freq.op_list_pix is not None: + if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: + temp = _np.zeros((self.freq.size), dtype=value.dtype) + if value.ndim == 1: + temp[self.freq.op_range_pix] = value + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax) + elif value.shape[self.config['nd_axis']] == self.freq.size: + temp = _np.zeros((self.freq.size), dtype=value.dtype) + if value.ndim == 1: + temp[self.freq.op_range_pix] = value[self.freq.op_range_pix] + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax)[self.freq.op_range_pix] + + else: + raise TypeError('data is of an unrecognized shape: {}'.format(value.shape)) + self._data = 1 * temp + del temp + else: + if value.ndim == 1: + self._data = value + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + self._data = self.config['nd_fcn'](value, axis=nd_ax) + + @property + def freq(self): + return self._freq + + @freq.setter + def freq(self, value): + if isinstance(value, _Frequency): + self._freq = value + elif isinstance(value, _np.ndarray): + self.freq = _Frequency(data=value) + else: + raise TypeError('freq must be of type crikit.data.Frequency') + + @property + def f(self): + """ + Convenience attribute: return frequency vector within operating (op) \ + range + """ + return self.freq.op_range_freq + + @property + def f_full(self): + """ + Convenience attribute: return full frequency vector + """ + return self.freq.data + + @property + def units(self): + return self._units + + @units.setter + def units(self, value): + if isinstance(value, str): + self._units = value + else: + raise TypeError('units must be of type str') + + @property + def label(self): + return self._label + + @label.setter + def label(self, value): + if isinstance(value, str): + self._label = value + else: + raise TypeError('label must be of type str') + + @property + def meta(self): + temp_dict = self._meta.copy() + + if self.freq.calib is not None: + try: + calib_dict = {} + calib_prefix = 'Calib.' + + calib_dict[calib_prefix + 'a_vec'] = self.freq.calib['a_vec'] + calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib['ctr_wl'] + calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib['ctr_wl0'] + calib_dict[calib_prefix + 'n_pix'] = self.freq.calib['n_pix'] + calib_dict[calib_prefix + 'probe'] = self.freq.calib['probe'] + + try: # Doesn't really matter if we have the units + calib_dict[calib_prefix + 'units'] = self.freq.calib['units'] + except Exception: + pass + + except Exception: + print('Could not get calibration information') + else: + temp_dict.update(calib_dict) + + if self.freq.calib_orig is not None: + try: + calib_dict = {} + calib_prefix = 'CalibOrig.' + + calib_dict[calib_prefix + 'a_vec'] = self.freq.calib_orig['a_vec'] + calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib_orig['ctr_wl'] + calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib_orig['ctr_wl0'] + calib_dict[calib_prefix + 'n_pix'] = self.freq.calib_orig['n_pix'] + calib_dict[calib_prefix + 'probe'] = self.freq.calib_orig['probe'] + + try: # Doesn't really matter if we have the units + calib_dict[calib_prefix + 'units'] = self.freq.calib_orig['units'] + except Exception: + pass + + except Exception: + print('Could not get calibration information') + else: + temp_dict.update(calib_dict) + + # return self._meta + return temp_dict + + @meta.setter + def meta(self, value): + if isinstance(value, dict): + self._meta = value + else: + raise TypeError('meta must be of type dict') + + @property + def f_pix(self): + if self._data is not None: + return self._data.shape[-1] + + @property + def ndim(self): + if self._data is None: + return None + elif isinstance(self._data, _np.ndarray): + return self._data.ndim + else: + return len(self._data.shape) + + @property + def shape(self): + if self._data is None: + return None + else: + return self._data.shape + + @property + def size(self): + if self._data is None: + return None + else: + return self._data.size + + def mean(self, extent=None, over_space=True): + """ + Return mean spectrum (or mean over extent [list with 2 elements]). If\ + over_space is False, returns reps-number of mean spectra + """ + if self._data is None: + return None + + ndim = len(self._data.shape) + + if ndim == 1: + if isinstance(self._data, _np.ndarray): + return self._data.mean() + else: + return _np.mean(self._data) + + if ndim > 1: + if over_space is True: + axes = tuple(_np.arange(ndim - 1)) + else: + axes = -1 + + if isinstance(self._data, _np.ndarray): + if extent is None: + return self._data.mean(axis=axes) + else: + return self._data[:, extent[0]:extent[1] + 1].mean(axis=axes) + else: + if extent is None: + return _np.mean(self._data, axis=axes) + else: + return _np.mean(self._data[:, extent[0]:extent[1] + 1], + axis=axes) + + def std(self, extent=None, over_space=True): + """ + Return standard deviation (std) spectrum (or std over extent + [list with 2 elements]). If over_space is False, reps (or reps x reps) + number of std's. + """ + if self._data is None: + return None + + ndim = len(self._data.shape) + + if ndim == 1: + if isinstance(self._data, _np.ndarray): + return self._data.std() + else: + return _np.std(self._data) + + if ndim > 1: + if over_space is True: + axes = tuple(_np.arange(ndim - 1)) + else: + axes = -1 + + if isinstance(self._data, _np.ndarray): + if extent is None: + return self._data.std(axis=axes) + else: + return self._data[:, extent[0]:extent[1] + 1].std(axis=axes) + else: + if extent is None: + return _np.std(self._data, axis=axes) + else: + return _np.std(self._data[:, extent[0]:extent[1] + 1], + axis=axes) + + def subtract(self, spectrum, overwrite=True): + """ + Subtract spectrum from data + """ + if isinstance(spectrum, Spectrum): + if overwrite: + self.data -= spectrum.data + return None + else: + return self.data - spectrum.data + elif isinstance(spectrum, _np.ndarray): + if overwrite: + self.data -= spectrum + return None + else: + return self.data - spectrum + + def __sub__(self, spectrum): + return self.subtract(spectrum, overwrite=False) + + +class Hsi(Spectrum): + """ + Hyperspectral imagery class + + Parameters + ---------- + data : 3D ndarray [y_pix, x_pix, f_pix] + HSI image + + mask : 3D ndarray (int) [y_pix, x_pix, f_pix] + 0,1 mask with 1 is a usable pixel and 0 is not + + freq : crikit.data.frequency.Frequency instance + Frequency [wavelength, wavenumber] object (i.e., the independent \ + variable) + + label : str + Image label (i.e., a string describing what the image is) + + units : str + Units of image (e.g., intensity) + + x_rep : crikit.data.replicate.Replicate instance, Not implemented yet + x-axis spatial object + + y_rep : crikit.data.replicate.Replicate instance, Not implemented yet + x-axis spatial object + + x : 1D ndarray + x-axis spatial vector + + y : 1D ndarray + y-axis spatial vector + + meta : dict + Meta-data dictionary + + Attributes + ---------- + shape : tuple, read-only + Shape of data + + size : int, read-only + Size of data (i.e., total number of entries) + + extent : list, read-only + Extent of image [xmin, xmax, ymin, ymax] + + Methods + ------- + mean : 1D ndarray + Mean spectrum. If extent [a,b] is provided, calculate mean over that\ + inclusive region. + + std : 1D ndarray + Standard deviation of spectrum. If extent [a,b] is provided, calculate standard\ + deviation over that inclusive region. + + subtract : 3D ndarray or None + Subtract spectrum or object + + Notes + ----- + * freq object contains some useful parameters such as op_range_* and \ + plot_range_*, which define spectral regions-of-interest. (It's debatable \ + as to whether those parameters should be in Frequency or Spectrum classes) -class Spectra(_Spectrum): + """ + + # Configurations + config = {} + config['nd_axis'] = -1 + + def __init__(self, data=None, freq=None, x=None, y=None, x_rep=None, + y_rep=None, label=None, units=None, meta=None): + + super().__init__(data, freq, label, units, meta) + self._x_rep = _Replicate() + self._y_rep = _Replicate() + self._mask = None + + self._x_rep = _Replicate(data=x) + self._y_rep = _Replicate(data=y) + + if x is None and x_rep is not None: + self.x_rep = _copy.deepcopy(x_rep) + if y is None and y_rep is not None: + self.y_rep = _copy.deepcopy(y_rep) + + @staticmethod + def _mean_axes(*args, **kwargs): + """ Inhereted from Spectrum """ + raise NotImplementedError('Only applicable to Spectrum class.') + + @staticmethod + def _reshape_axes(shape, spectral_axis): + """ + Parameters + ---------- + shape : tuple + Input data shape + + spectral_axis : int + Spectral axis + + Returns + ------- + Reshape vector + """ + ndim = len(shape) + + if ndim == 1: + out = [1, 1, 1] + out[spectral_axis] = shape[0] + elif ndim == 2: # ! Super-wonky + out = [1, shape[0], shape[1]] + elif ndim == 3: + out = shape + elif ndim > 3: + out = [-1, shape[-2], shape[-1]] + else: + raise ValueError('Shape error') + + return tuple(out) + + @property + def extent(self): + if (self.x is not None) & (self.y is not None): + return [self.x.min(), self.x.max(), self.y.min(), self.y.max()] + + @property + def mask(self): + return self._mask + + @property + def x_rep(self): + return self._x_rep + + @x_rep.setter + def x_rep(self, value): + if isinstance(value, _Replicate): + self._x_rep = value + elif isinstance(value, _np.ndarray): + self._x_rep.data = value + + @property + def y_rep(self): + return self._y_rep + + @property + def x(self): + return self._x_rep.data + + @x.setter + def x(self, value): + self._x_rep.data = value + + @property + def y(self): + return self._y_rep.data + + @y.setter + def y(self, value): + self._y_rep.data = value + + @y_rep.setter + def y_rep(self, value): + if isinstance(value, _Replicate): + self._y_rep = value + elif isinstance(value, _np.ndarray): + self._y_rep.data = value + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, _np.ndarray): + raise TypeError('data must be of type ndarray, not {}'.format(type(value))) + + ax_rs = self._reshape_axes(value.shape, self.config['nd_axis']) + + # self._mask = _np.ones(tuple([n for n in range(3) if n != self.config['nd_axis']]), + # dtype=int) + + if self.freq is None or self.freq.op_list_pix is None: + self._data = value.reshape(ax_rs) + else: + if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: + temp = _np.zeros((self._data.shape), dtype=value.dtype) + temp[:, :, self.freq.op_range_pix] = value.reshape(ax_rs) + self._data = 1 * temp + del temp + elif value.shape[self.config['nd_axis']] == self._data.shape[self.config['nd_axis']]: + temp = _np.zeros((self._data.shape), dtype=value.dtype) + temp[..., self.freq.op_range_pix] = value.reshape(ax_rs)[..., self.freq.op_range_pix] + self._data = 1 * temp + del temp + + def check(self): + """ + Check x, y, and freq to make sure the dimensions agree with data + """ + if self._data is None: + print('Hsi check: data is None, not checking') + else: + if self._x_rep._data is None: + self._x_rep._data = _np.arange(self.shape[1]) + self._x_rep._label = 'X' + self._x_rep._units = 'pix' + print('Hsi check: setting x to pixels') + elif self._x_rep._data.size != self._data.shape[1]: + self._x_rep = _Replicate() + self._x_rep._data = _np.arange(self.shape[1]) + self._x_rep._label = 'X' + self._x_rep._units = 'pix' + print('Hsi check: setting x to pixels') + + if self._y_rep._data is None: + self._y_rep._data = _np.arange(self.shape[0]) + self._y_rep._label = 'Y' + self._y_rep._units = 'pix' + print('Hsi check: setting y to pixels') + elif self._y_rep._data.size != self._data.shape[0]: + self._y_rep = _Replicate() + self._y_rep._data = _np.arange(self.shape[0]) + self._y_rep._label = 'Y' + self._y_rep._units = 'pix' + print('Hsi check: setting y to pixels') + + if self.freq._data is None: + self.freq._data = _np.arange(self.shape[-1]) + self.freq._label = 'Frequency' + self.freq._units = 'pix' + print('Hsi check: setting freq to pixels') + elif self.freq._data.size != self._data.shape[-1]: + self.freq = _Frequency() + self.freq._data = _np.arange(self.shape[-1]) + print('Hsi check: setting freq to pixels') + return None + + def subtract(self, spectra, overwrite=True): + """ + Subtract spectrum from data + """ + # Order IS important + if isinstance(spectra, Hsi): + if overwrite: + self.data -= spectra.data + return None + else: + return self.data - spectra.data + elif isinstance(spectra, Spectrum): + if overwrite: + self.data -= spectra.data[None, None, :] + return None + else: + return self.data - spectra.data + elif isinstance(spectra, _np.ndarray): + if spectra.shape == self.data.shape: + if overwrite: + self.data -= spectra + return None + else: + return self.data - spectra + else: + if overwrite: + self.data -= spectra[None, None, :] + return None + else: + return self.data - spectra[None, None, :] + + def get_rand_spectra(self, num, pt_sz=1, quads=False, full=False): + + mlen, nlen, freqlen = self.data.shape + + if quads: + num_spectra = num + 5 + else: + num_spectra = num + + if _np.iscomplexobj(self.data): + dtype = complex + else: + dtype = float + + temp = _np.zeros((num_spectra, self.data.shape[-1]), dtype=dtype) + + quad_mid_row = int(_np.round(mlen / 2)) + quad_mid_col = int(_np.round(nlen / 2)) + center_row = (int(_np.round(mlen / 3)), int(_np.round(2 * mlen / 3))) + center_col = (int(_np.round(nlen / 3)), int(_np.round(2 * nlen / 3))) + + start_count = 0 + if quads: + # QUADS + # Bottom-left + temp[0, :] = _np.mean(self.data[0:quad_mid_row, 0:quad_mid_col, :], axis=(0, 1)) + + # Upper-left + temp[1, :] = _np.mean(self.data[0:quad_mid_row, quad_mid_col + 1::, :], axis=(0, 1)) + + # Upper-right + temp[2, :] = _np.mean(self.data[quad_mid_row + 1::, quad_mid_col + 1::, :], axis=(0, 1)) + + # Bottom-right + temp[3, :] = _np.mean(self.data[quad_mid_row + 1::, 0:quad_mid_col, :], axis=(0, 1)) + + # Center + temp[4, :] = _np.mean(self.data[center_row[0]:center_row[1], center_col[0]:center_col[1], :], axis=(0, 1)) + + start_count += 5 + else: + pass + + rand_rows = ((mlen - pt_sz - 1) * _np.random.rand(num_spectra)).astype(int) + rand_cols = ((nlen - pt_sz - 1) * _np.random.rand(num_spectra)).astype(int) + + for count in _np.arange(start_count, num_spectra): + if pt_sz == 1: + temp[count, :] = _np.squeeze(self.data[rand_rows[count - start_count], + rand_cols[count - start_count]]) + else: + + rows = [rand_rows[count - start_count] - (pt_sz - 1), + rand_rows[count - start_count] + pt_sz] + cols = [rand_cols[count - start_count] - (pt_sz - 1), + rand_cols[count - start_count] + pt_sz] + + if rows[0] < 0: + rows[0] = 0 + if rows[1] >= mlen: + rows[1] = mlen - 1 + if cols[0] < 0: + cols[0] = 0 + if cols[1] >= nlen: + cols[1] = nlen - 1 + + if cols[0] == cols[1] or rows[0] == rows[1]: + pass + else: + temp[count, :] = _np.squeeze(_np.mean(self.data[rows[0]:rows[1], cols[0]:cols[1], :], axis=(0, 1))) + + if (not full) and (self.freq.data is not None): + temp = temp[..., self.freq.op_range_pix] + + return temp + + def __sub__(self, spectrum): + return self.subtract(spectrum, overwrite=False) + + +class Spectra(Spectrum): """ Spectra class @@ -125,7 +846,7 @@ def data(self, value): print('Spectra: converting data input from {}D to 2D ndarray'.format(value.ndim)) if value.shape[-1] == self.freq.op_range_pix.size: temp = _np.zeros((self._data.shape), dtype=value.dtype) - temp[:,self.freq.op_range_pix] = value + temp[:, self.freq.op_range_pix] = value self._data = temp elif value.shape[-1] == self.freq.size: temp = _np.zeros((self._data.shape), dtype=value.dtype) @@ -160,12 +881,12 @@ def subtract(self, spectra, overwrite=True): return None else: return self.data - spectra.data - elif isinstance(spectra, _Spectrum): + elif isinstance(spectra, Spectrum): if overwrite: - self.data -= spectra.data[None,:] + self.data -= spectra.data[None, :] return None else: - return self.data - spectra.data[None,:] + return self.data - spectra.data[None, :] elif isinstance(spectra, _np.ndarray): if spectra.shape == self.data.shape: if overwrite: @@ -175,19 +896,20 @@ def subtract(self, spectra, overwrite=True): return self.data - spectra else: if overwrite: - self.data -= spectra[None,:] + self.data -= spectra[None, :] return None else: - return self.data - spectra[None,:] + return self.data - spectra[None, :] def __sub__(self, spectrum): return self.subtract(spectrum, overwrite=False) -if __name__ == '__main__': # pragma: no cover + +if __name__ == '__main__': # pragma: no cover sp = Spectra() print(sp.__dict__) - print('Subclass? : {}'.format(issubclass(Spectra,_Spectrum))) - print('Instance of Spectra? : {}'.format(isinstance(sp,Spectra))) - print('Instance of Spectrum? : {}'.format(isinstance(sp,_Spectrum))) - print('Type(sp) == Spectrum? : {}'.format(type(sp)==_Spectrum)) - print('Type(sp) == Spectra? : {}'.format(type(sp)==Spectra)) \ No newline at end of file + print('Subclass? : {}'.format(issubclass(Spectra, Spectrum))) + print('Instance of Spectra? : {}'.format(isinstance(sp, Spectra))) + print('Instance of Spectrum? : {}'.format(isinstance(sp, Spectrum))) + print('Type(sp) == Spectrum? : {}'.format(type(sp) == Spectrum)) + print('Type(sp) == Spectra? : {}'.format(type(sp) == Spectra)) diff --git a/crikit/data/spectrum.py b/crikit/data/spectrum.py deleted file mode 100644 index 4abc8d1..0000000 --- a/crikit/data/spectrum.py +++ /dev/null @@ -1,392 +0,0 @@ -""" -Spectrum class and function - -""" - -import numpy as _np -import copy as _copy - -from crikit.data.frequency import Frequency as _Frequency - -__all__ = ['Spectrum'] - -class Spectrum: - """ - Spectrum class - - Attributes - ---------- - data : 1D ndarray [f_pix] - Spectrum - - freq : crikit.data.Frequency instance - Frequency [wavelength, wavenumber] object (i.e., the independent \ - variable) - - label : str - Spectrum label (i.e., a string describing what the spectrum is) - - units : str - Units of spectrum - - meta : dict - Meta-data dictionary - - f_pix : int, read-only - Size of data. Note: this matches the size of data and does NOT check \ - the size of freq.freq_vec. - - ndim : int, read-only - Number of data dimensions - - shape : tuple, read-only - Shape of data - - size : int, read-only - Size of data (i.e., total number of entries) - - Methods - ------- - mean : int - Mean value. If extent [a,b] is provided, calculate mean over that\ - inclusive region. - - std : int - Standard deviation. If extent [a,b] is provided, calculate standard\ - deviation over that inclusive region. - - subtract : 1D ndarray or None - Subtract spectrum or object - - Notes - ----- - * freq object contains some useful parameters such as op_range* and \ - plot_range*, which define spectral regions-of-interest. (It's debatable \ - as to whether those parameters should be in Frequency or Spectrum classes) - - """ - - # Configurations - config = {} - config['nd_axis'] = -1 - config['nd_fcn'] = _np.mean - - def __init__(self, data=None, freq=None, label=None, units=None, meta=None): - - self._data = None - self._freq = _Frequency() - self._label = None - self._units = None - self._meta = {} - - if data is not None: - self.data = _copy.deepcopy(data) - if freq is not None: - self.freq = _copy.deepcopy(freq) - else: - self.freq = _Frequency() - if label is not None: - self.label = _copy.deepcopy(label) - if units is not None: - self.units = _copy.deepcopy(units) - if meta is not None: - self._meta = _copy.deepcopy(meta) - - @staticmethod - def _mean_axes(ndim, axis): - """ - Parameters - ---------- - ndim : int - Number of dimensions of input data (target is 1D spectrum) - - axis : int - For ND data, axis is remaining axis - - Returns - ------- - Vector that describes what axes to operate (using a mean or similar method) with - axis parameter - """ - if axis < 0: - axis2 = ndim + axis - else: - axis2 = axis - return tuple([n for n in range(ndim) if n != axis2]) - - @property - def data(self): - return self._data - - @data.setter - def data(self, value): - if not isinstance(value, _np.ndarray): - raise TypeError('data must be of type ndarray') - - # If sub-range of operation is defined. Only perform action over op_range_pix - if self.freq is not None and self.freq.op_list_pix is not None: - if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: - temp = _np.zeros((self.freq.size), dtype=value.dtype) - if value.ndim == 1: - temp[self.freq.op_range_pix] = value - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax) - elif value.shape[self.config['nd_axis']] == self.freq.size: - temp = _np.zeros((self.freq.size), dtype=value.dtype) - if value.ndim == 1: - temp[self.freq.op_range_pix] = value[self.freq.op_range_pix] - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax)[self.freq.op_range_pix] - - else: - raise TypeError('data is of an unrecognized shape: {}'.format(value.shape)) - self._data = 1*temp - del temp - else: - if value.ndim == 1: - self._data = value - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - self._data = self.config['nd_fcn'](value, axis=nd_ax) - - - @property - def freq(self): - return self._freq - - @freq.setter - def freq(self, value): - if isinstance(value, _Frequency): - self._freq = value - elif isinstance(value, _np.ndarray): - self.freq = _Frequency(data=value) - else: - raise TypeError('freq must be of type crikit.data.Frequency') - - @property - def f(self): - """ - Convenience attribute: return frequency vector within operating (op) \ - range - """ - return self.freq.op_range_freq - - @property - def f_full(self): - """ - Convenience attribute: return full frequency vector - """ - return self.freq.data - - @property - def units(self): - return self._units - - @units.setter - def units(self, value): - if isinstance(value, str): - self._units = value - else: - raise TypeError('units must be of type str') - - @property - def label(self): - return self._label - - @label.setter - def label(self, value): - if isinstance(value, str): - self._label = value - else: - raise TypeError('label must be of type str') - - @property - def meta(self): - temp_dict = self._meta.copy() - - if self.freq.calib is not None: - try: - calib_dict = {} - calib_prefix = 'Calib.' - - calib_dict[calib_prefix + 'a_vec'] = self.freq.calib['a_vec'] - calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib['ctr_wl'] - calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib['ctr_wl0'] - calib_dict[calib_prefix + 'n_pix'] = self.freq.calib['n_pix'] - calib_dict[calib_prefix + 'probe'] = self.freq.calib['probe'] - - try: # Doesn't really matter if we have the units - calib_dict[calib_prefix + 'units'] = self.freq.calib['units'] - except: - pass - - except: - print('Could not get calibration information') - else: - temp_dict.update(calib_dict) - - if self.freq.calib_orig is not None: - try: - calib_dict = {} - calib_prefix = 'CalibOrig.' - - calib_dict[calib_prefix + 'a_vec'] = self.freq.calib_orig['a_vec'] - calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib_orig['ctr_wl'] - calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib_orig['ctr_wl0'] - calib_dict[calib_prefix + 'n_pix'] = self.freq.calib_orig['n_pix'] - calib_dict[calib_prefix + 'probe'] = self.freq.calib_orig['probe'] - - try: # Doesn't really matter if we have the units - calib_dict[calib_prefix + 'units'] = self.freq.calib_orig['units'] - except: - pass - - except: - print('Could not get calibration information') - else: - temp_dict.update(calib_dict) - - # return self._meta - return temp_dict - - @meta.setter - def meta(self, value): - if isinstance(value, dict): - self._meta = value - else: - raise TypeError('meta must be of type dict') - - @property - def f_pix(self): - if self._data is not None: - return self._data.shape[-1] - - @property - def ndim(self): - if self._data is None: - return None - elif isinstance(self._data, _np.ndarray): - return self._data.ndim - else: - return len(self._data.shape) - - @property - def shape(self): - if self._data is None: - return None - else: - return self._data.shape - - @property - def size(self): - if self._data is None: - return None - else: - return self._data.size - - def mean(self, extent=None, over_space=True): - """ - Return mean spectrum (or mean over extent [list with 2 elements]). If\ - over_space is False, returns reps-number of mean spectra - """ - if self._data is None: - return None - - ndim = len(self._data.shape) - - if ndim == 1: - if isinstance(self._data, _np.ndarray): - return self._data.mean() - else: - return _np.mean(self._data) - - if ndim > 1: - if over_space == True: - axes = tuple(_np.arange(ndim-1)) - else: - axes = -1 - - if isinstance(self._data, _np.ndarray): - if extent is None: - return self._data.mean(axis=axes) - else: - return self._data[:,extent[0]:extent[1]+1].mean(axis=axes) - else: - if extent is None: - return _np.mean(self._data, axis=axes) - else: - return _np.mean(self._data[:,extent[0]:extent[1]+1], - axis=axes) - - def std(self, extent=None, over_space=True): - """ - Return standard deviation (std) spectrum (or std over extent - [list with 2 elements]). If over_space is False, reps (or reps x reps) - number of std's. - """ - if self._data is None: - return None - - ndim = len(self._data.shape) - - if ndim == 1: - if isinstance(self._data, _np.ndarray): - return self._data.std() - else: - return _np.std(self._data) - - if ndim > 1: - if over_space == True: - axes = tuple(_np.arange(ndim-1)) - else: - axes = -1 - - if isinstance(self._data, _np.ndarray): - if extent is None: - return self._data.std(axis=axes) - else: - return self._data[:,extent[0]:extent[1]+1].std(axis=axes) - else: - if extent is None: - return _np.std(self._data, axis=axes) - else: - return _np.std(self._data[:,extent[0]:extent[1]+1], - axis=axes) - - def subtract(self, spectrum, overwrite=True): - """ - Subtract spectrum from data - """ - if isinstance(spectrum, Spectrum): - if overwrite: - self.data -= spectrum.data - return None - else: - return self.data - spectrum.data - elif isinstance(spectrum, _np.ndarray): - if overwrite: - self.data -= spectrum - return None - else: - return self.data - spectrum - - def __sub__(self, spectrum): - return self.subtract(spectrum, overwrite=False) - - -if __name__ == '__main__': # pragma: no cover - import timeit as _timeit - - N = 10001 - wn = _np.linspace(500,3000,N) - sp = Spectrum(data=_np.random.rand(N) + 1j*_np.random.rand(N), freq=wn) - - tmr = _timeit.default_timer() - sp.data[200:500] - tmr -= _timeit.default_timer() - print(-tmr) diff --git a/crikit/data/tests/test_hsi.py b/crikit/data/tests/test_hsi.py index 13e9437..446cd64 100644 --- a/crikit/data/tests/test_hsi.py +++ b/crikit/data/tests/test_hsi.py @@ -3,12 +3,12 @@ import numpy.testing import pytest -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi @pytest.fixture(scope="function") def make_datasets(): diff --git a/crikit/data/tests/test_mosaic.py b/crikit/data/tests/test_mosaic.py index 639aa44..a02f980 100644 --- a/crikit/data/tests/test_mosaic.py +++ b/crikit/data/tests/test_mosaic.py @@ -42,7 +42,7 @@ def test_crop_2D(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop) @@ -90,7 +90,7 @@ def test_crop_3D(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -143,7 +143,7 @@ def test_3D_crop_transpose_flips(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -200,7 +200,7 @@ def test_3D_crop_transpose_flips_2(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -242,7 +242,7 @@ def test_2D_uniform_obj(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float assert mos.unitshape == (m_obj, n_obj) assert mos.unitshape_orig == (m_obj, n_obj) @@ -278,7 +278,7 @@ def test_3D_uniform_obj(): assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float with pytest.raises(ValueError): mos.mosaic2d((m_side, n_side)).shape diff --git a/crikit/data/tests/test_mosaic_hdf.py b/crikit/data/tests/test_mosaic_hdf.py index 3f685f8..ee99713 100644 --- a/crikit/data/tests/test_mosaic_hdf.py +++ b/crikit/data/tests/test_mosaic_hdf.py @@ -5,7 +5,7 @@ import pytest import h5py -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.data.mosaic import Mosaic @@ -31,7 +31,7 @@ def hdf_dataset2(): time.sleep(1) try: os.remove(filename) - except: + except Exception: print('Could not delete {}'.format(filename)) def test_hdf2(hdf_dataset2): @@ -101,13 +101,13 @@ def test_big_to_small_3d_output_given(): time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out)) def test_big_to_small_3d_output_given_crop(): @@ -172,13 +172,13 @@ def test_big_to_small_3d_output_given_crop(): time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out)) def test_big_to_small_3d_output_given_crop_transpose_flips(): @@ -244,11 +244,11 @@ def test_big_to_small_3d_output_given_crop_transpose_flips(): time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out)) diff --git a/crikit/data/tests/test_spectra.py b/crikit/data/tests/test_spectra.py index 61555d8..6b05ed2 100644 --- a/crikit/data/tests/test_spectra.py +++ b/crikit/data/tests/test_spectra.py @@ -3,12 +3,12 @@ import numpy.testing import pytest -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi @pytest.fixture(scope="function") def make_datasets(): diff --git a/crikit/data/tests/test_spectrum.py b/crikit/data/tests/test_spectrum.py index 7c0a68d..4214f16 100644 --- a/crikit/data/tests/test_spectrum.py +++ b/crikit/data/tests/test_spectrum.py @@ -3,12 +3,12 @@ import numpy.testing import pytest -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi @pytest.fixture(scope="function") def make_datasets(): diff --git a/crikit/data/tests/~test_data_indexing.py b/crikit/data/tests/~test_data_indexing.py index 77292ea..4e28a84 100644 --- a/crikit/data/tests/~test_data_indexing.py +++ b/crikit/data/tests/~test_data_indexing.py @@ -7,9 +7,9 @@ import numpy as np import numpy.testing as np_testing -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.utils.general import find_nearest def test_spectrum(): diff --git a/crikit/datasets/model.py b/crikit/datasets/model.py index a179e03..603587c 100644 --- a/crikit/datasets/model.py +++ b/crikit/datasets/model.py @@ -19,7 +19,7 @@ class Model: _M = 300 _N = 300 - def __init__(self, subsample=1, dtype=_np.complex): + def __init__(self, subsample=1, dtype=complex): self.n_layers = 7 # Number of components self.img_shape = [300, 300] # Spaital imaging shape @@ -68,7 +68,7 @@ def __init__(self, subsample=1, dtype=_np.complex): gd_spec = _get_data('crikit.datasets', '{}{}{}'.format(self.__spec_prefix, num, '.csv')) self.spec_list.append(_np.genfromtxt(_BytesIO(gd_spec), delimiter=',')) - except: + except Exception: print('Failed to import model layer and/or spectral information') else: print('Model spatial size: {}'.format(self.img_shape)) @@ -115,7 +115,7 @@ def make_spectra(self, f): self.n_peak_list.append(a_vec.size) self.spectra[num, :] = _np.sum(a_vec[:,None] / (omega_vec [:,None] - f[None,:] - 1j*gamma_vec[:,None]), axis=0) - except: + except Exception: print('Failed to make model spectra') else: print('Model spectral size: {}'.format(self.f.size)) @@ -136,7 +136,7 @@ def make_hsi(self, f=None): # self.hsi = _np.zeros(self.img_shape + [self._f.size], dtype=self.dtype) self.hsi = _np.dot(self.layers, self.spectra) print('Model HSI shape: {}'.format(self.hsi.shape)) - except: + except Exception: print('Faled to make model HSI') #%% diff --git a/crikit/io/csv_nist.py b/crikit/io/csv_nist.py index 7d152bb..bea8fb7 100644 --- a/crikit/io/csv_nist.py +++ b/crikit/io/csv_nist.py @@ -9,9 +9,9 @@ import numpy as _np import copy as _copy -from crikit.data.spectrum import Spectrum as _Spectrum +from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra -from crikit.data.hsi import Hsi as _Hsi +from crikit.data.spectra import Hsi as _Hsi from configparser import ConfigParser as _ConfigParser # @@ -35,7 +35,7 @@ def csv_nist_import_data(pth, filename_header, filename_data, filename_data : str File name of data - output_cls_instance : crikit.data.spectrum.Spectrum (or subclass) + output_cls_instance : crikit.data.spectra.Spectrum (or subclass) Spectrum class (or sub) object Returns @@ -56,7 +56,7 @@ def csv_nist_import_data(pth, filename_header, filename_data, try: with open(pfname_header,'r') as _: pass - except: + except Exception: print('Invalid header filename') else: valid_import_locs += 1 @@ -64,7 +64,7 @@ def csv_nist_import_data(pth, filename_header, filename_data, try: with open(pfname_data,'r') as _: pass - except: + except Exception: print('Invalid data filename') else: valid_import_locs += 1 @@ -126,10 +126,10 @@ def csv_nist_import_data(pth, filename_header, filename_data, try: # int v = int(each_val) #print('Integer') - except: + except Exception: try: # float v = float(each_val) - except: # string + except Exception: # string v = str.strip(each_val,'"') #print('{}.{}: {}'.format(each_section,each_key, v)) attr.update({k:v}) @@ -160,7 +160,7 @@ def csv_nist_import_data(pth, filename_header, filename_data, y_steps = config.getint('Y scan Paramters','Y steps') y_step_size = config.getfloat('Y scan Paramters','Y step size (um)') y = _np.linspace(y_start, y_start + y_step_size * (y_steps-1), y_steps) - except: # In case typo is corrected in the future + except Exception: # In case typo is corrected in the future y_start = config.getfloat('Y scan Parameters','Y start (um)') y_steps = config.getint('Y scan Parameters','Y steps') y_step_size = config.getfloat('Y scan Parameters','Y step size (um)') @@ -175,10 +175,10 @@ def csv_nist_import_data(pth, filename_header, filename_data, try: # int v = int(each_val) #print('Integer') - except: + except Exception: try: # float v = float(each_val) - except: # string + except Exception: # string v = str.strip(each_val,'"') #print('{}.{}: {}'.format(each_section,each_key, v)) attr.update({k:v}) @@ -231,14 +231,14 @@ def csv_nist_import_data(pth, filename_header, filename_data, # Figure out fixed positions later - except: + except Exception: pass else: output_cls_instance.data = data output_cls_instance.meta = attr return True - except: + except Exception: print('Something failed in import') if __name__ == '__main__': diff --git a/crikit/io/hdf5.py b/crikit/io/hdf5.py index cde9ed0..b88c547 100644 --- a/crikit/io/hdf5.py +++ b/crikit/io/hdf5.py @@ -7,17 +7,120 @@ @author: chc """ -import os as _os +import numpy as np -import numpy as _np +from crikit.data.spectra import Spectrum +from crikit.data.spectra import Spectra +from crikit.data.spectra import Hsi -from crikit.data.spectrum import Spectrum as _Spectrum -from crikit.data.spectra import Spectra as _Spectra -from crikit.data.hsi import Hsi as _Hsi +import crikit.io.lazy5 as lazy5 +from crikit.utils.general import find_nearest +from scipy.interpolate import interp1d -import lazy5 as _lazy5 -__all__ = ['hdf_import_data'] +__all__ = ['hdf_import_data', 'hdf_import_data_macroraster'] + + +def hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance, config_dict=None): + """ + Import dataset(s) from HDF file with each dset being a single line scan. + + Parameters + ---------- + pth : str + Path + + filename : str + File name + + dset_list : list + List of 1 or more datasets + + output_cls_instance : crikit.data.spectra.Spectrum (or subclass) + Spectrum class (or sub) object + + Returns + ------- + Success : bool + Success of import + Data, Meta : list (ndarray, dict) + If output_cls_instance is None and import is successful, will \ + return the data from dset_list and associated meta data. + + """ + + config_dict_template = {'fast_start': 'Macro.Raster.Fast.Start', + 'fast_stop': 'Macro.Raster.Fast.Stop', + 'fast_steps': 'Macro.Raster.Fast.Steps', + 'fast_pos_sampled': 'MicroStage.raster.fast.pos_sample_vec', + 'n_imgs_at_sampled': 'MicroStage.raster.fast.n_images_at_pos_samples', + 'slow_start': 'Macro.Raster.Slow.Start', + 'slow_stop': 'Macro.Raster.Slow.Stop', + 'slow_steps': 'Macro.Raster.Slow.Steps', + 'slow_current_pos': 'MicroStage.raster.slow.pos', + 'n_pix': 'Spectrometer.calib.n_pix'} + config = {} + config.update(config_dict_template) + if config_dict is not None: + config.update(config_dict) + + # Join path and filename in an os-independant way + pfname = lazy5.utils.fullpath(filename, pth=pth) + + if not lazy5.inspect.valid_file(filename, pth=pth, verbose=True): + return False + elif not lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=False): + return False + else: + fof = lazy5.utils.FidOrFile(pfname, mode='r') + fid = fof.fid + + assert isinstance(output_cls_instance, Hsi) + assert isinstance(dset_list, list) + + all_xs = [] + all_ys = [] + + for num, dname in enumerate(dset_list): + # Convert to hardware-oriented dtype (endianess) + # dset_dtype_import = fid[dname].dtype.newbyteorder('=') + # dset_shp = fid[dname].shape + + curr_slice = fid[dname][:] + meta = lazy5.inspect.get_attrs_dset(fid, dname) + if num == 0: + dset_dtype_import = fid[dname].dtype.newbyteorder('=') + dset_shp = (meta[config['slow_steps']], meta[config['fast_steps']], + meta[config['n_pix']]) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) + + x_vec = np.linspace(meta[config['fast_start']], meta[config['fast_stop']], + meta[config['fast_steps']]) + y_vec = np.linspace(meta[config['slow_start']], meta[config['slow_stop']], + meta[config['slow_steps']]) + + curr_y_pos = meta[config['slow_current_pos']] + + curr_x_vec = meta[config['fast_pos_sampled']] + curr_n_imgs_vec = meta[config['n_imgs_at_sampled']] + + all_xs.extend(curr_x_vec.tolist()) + all_ys.extend([curr_y_pos]) + + intfcn = interp1d(curr_n_imgs_vec, curr_x_vec, kind='linear') + + int_fcn_intensity = interp1d(intfcn(np.arange(curr_slice.shape[0])), + curr_slice, axis=0, bounds_error=False, kind='linear', fill_value='extrapolate') + + y_idx = find_nearest(y_vec, curr_y_pos)[1] + output_cls_instance.data[y_idx, ...] = int_fcn_intensity(x_vec) + + # extent = [x_vec.min(), x_vec.max(), y_vec.min(), y_vec.max()] + + fid.close() + output_cls_instance.meta = meta + return True + def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): """ @@ -34,7 +137,7 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): dset_list : list List of 1 or more datasets - output_cls_instance : crikit.data.spectrum.Spectrum (or subclass) + output_cls_instance : crikit.data.spectra.Spectrum (or subclass) Spectrum class (or sub) object Returns @@ -47,27 +150,27 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): """ # Join path and filename in an os-independant way - pfname = _lazy5.utils.fullpath(filename, pth=pth) + pfname = lazy5.utils.fullpath(filename, pth=pth) - if not _lazy5.inspect.valid_file(filename, pth=pth, verbose=True): + if not lazy5.inspect.valid_file(filename, pth=pth, verbose=True): return False - elif not _lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=True): + elif not lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=True): return False else: - fof = _lazy5.utils.FidOrFile(pfname, mode='r') + fof = lazy5.utils.FidOrFile(pfname, mode='r') fid = fof.fid - if type(output_cls_instance) == _Hsi: + if type(output_cls_instance) == Hsi: print('Type Hsi') if isinstance(dset_list, str): # Convert to hardware-oriented dtype (endianess) dset_dtype_import = fid[dset_list].dtype.newbyteorder('=') dset_shp = fid[dset_list].shape - output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dset_list].read_direct(output_cls_instance.data) # output_cls_instance.data = fid[dset_list].value - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list) elif isinstance(dset_list, list): if len(dset_list) > 1: print('Cannot accept more than 1 HSI image at this time') @@ -77,30 +180,28 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): dset_dtype_import = fid[dname].dtype.newbyteorder('=') dset_shp = fid[dname].shape if num == 0: - output_cls_instance.data = _np.zeros(dset_shp, - dtype=dset_dtype_import) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dname].read_direct(output_cls_instance.data) # output_cls_instance.data = fid[dname][:] - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname) else: - output_cls_instance.data = _np.vstack((output_cls_instance.data, - fid[dname][:].astype(dset_dtype_import))) + output_cls_instance.data = np.vstack((output_cls_instance.data, fid[dname][:].astype(dset_dtype_import))) ret = True - elif type(output_cls_instance) == _Spectra: + elif type(output_cls_instance) == Spectra: print('Type Spectra') if isinstance(dset_list, str): # Convert to hardware-oriented dtype (endianess) dset_dtype_import = fid[dset_list].dtype.newbyteorder('=') if fid[dset_list].ndim == 2: # Compatible dimensions-- use read-direct dset_shp = fid[dset_list].shape - output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dset_list].read_direct(output_cls_instance.data) else: output_cls_instance.data = fid[dset_list].value.astype(dset_dtype_import) # output_cls_instance.data = fid[dset_list].value - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list) elif isinstance(dset_list, list): for num, dname in enumerate(dset_list): @@ -108,22 +209,21 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): dset_dtype_import = fid[dname].dtype.newbyteorder('=') if num == 0: output_cls_instance.data = fid[dname][:].astype(dset_dtype_import) - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname) else: - output_cls_instance.data = _np.vstack((output_cls_instance.data, - fid[dname][:].astype(dset_dtype_import))) + output_cls_instance.data = np.vstack((output_cls_instance.data, fid[dname][:].astype(dset_dtype_import))) ret = True - elif type(output_cls_instance) == _Spectrum: + elif type(output_cls_instance) == Spectrum: print('Type Spectrum') if isinstance(dset_list, str): # Convert to hardware-oriented dtype (endianess) dset_dtype_import = fid[dset_list].dtype.newbyteorder('=') dset_shp = fid[dset_list].shape - output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dset_list].read_direct(output_cls_instance.data) # output_cls_instance.data = fid[dset_list].value - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list) elif isinstance(dset_list, list): if len > 1: print('Will average spectra into a single spectrum') @@ -133,46 +233,44 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): dset_dtype_import = fid[dname].dtype.newbyteorder('=') dset_shp = fid[dname].shape if num == 0: - output_cls_instance.data = _np.zeros(dset_shp, - dtype=dset_dtype_import) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dname].read_direct(output_cls_instance.data) # output_cls_instance.data = fid[dname][:] - output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname) + output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname) else: output_cls_instance.data += fid[dname][:].astype(dset_dtype_import) - output_cls_instance.data /= num+1 + output_cls_instance.data /= num + 1 ret = True elif output_cls_instance is None: if isinstance(dset_list, str): # Convert to hardware-oriented dtype (endianess) dset_dtype_import = fid[dset_list].dtype.newbyteorder('=') dset_shp = fid[dset_list].shape - data = _np.zeros(dset_shp, dtype=dset_dtype_import) + data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dset_list].read_direct(data) # data = fid[dset_list].value - meta = _lazy5.inspect.get_attrs_dset(fid, dset_list) + meta = lazy5.inspect.get_attrs_dset(fid, dset_list) elif isinstance(dset_list, list): for num, dname in enumerate(dset_list): # Convert to hardware-oriented dtype (endianess) dset_dtype_import = fid[dname].dtype.newbyteorder('=') dset_shp = fid[dname].shape if num == 0: - data = _np.zeros(dset_shp, - dtype=dset_dtype_import) + data = np.zeros(dset_shp, dtype=dset_dtype_import) fid[dname].read_direct(data) # data = fid[dname][:] - meta = _lazy5.inspect.get_attrs_dset(fid, dname) + meta = lazy5.inspect.get_attrs_dset(fid, dname) else: - data = _np.vstack((data, fid[dname][:].astype(dset_dtype_import))) + data = np.vstack((data, fid[dname][:].astype(dset_dtype_import))) ret = [data, meta] else: raise TypeError('output_cls must be Spectrum, Spectra, or Hsi') - fid.close() return ret + if __name__ == '__main__': # pragma: no cover from crikit.io.meta_configs import (special_nist_bcars2 as _snb) @@ -181,35 +279,34 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): pth = '../' filename = 'mP2_w_small.h5' - dset = '/Spectra/Dark_3_5ms_2' - tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake') + tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake') assert not tester - tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake_dset') + tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake_dset') assert not tester - tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', - dset_list=['fake_dset1', 'fake_dset2']) + tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', + dset_list=['fake_dset1', 'fake_dset2']) assert not tester print('Path: {}'.format(pth)) - tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename, dset_list=dset, verbose=True) + tester = lazy5.inspect.valid_dsets(pth=pth, file=filename, dset_list=dset, verbose=True) assert tester print('--------------\n\n') - spect_dark = _Spectra() - tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename, - dset_list=['/Spectra/Dark_3_5ms_2']) + spect_dark = Spectra() + tester = lazy5.inspect.valid_dsets(pth=pth, file=filename, + dset_list=['/Spectra/Dark_3_5ms_2']) hdf_import_data(pth, filename, '/Spectra/Dark_3_5ms_2', spect_dark) - #hdf_process_attr(rosetta, spect_dark) + # hdf_process_attr(rosetta, spect_dark) print('Shape of dark spectra: {}'.format(spect_dark.shape)) print('Shape of dark spectra.mean(): {}'.format(spect_dark.mean().shape)) print('Dtype of dark spectra: {}'.format(spect_dark._data.dtype)) print('') - img = _Hsi() + img = Hsi() hdf_import_data(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img) print('Shape of img: {}'.format(img.shape)) print('Shape of img.mean(): {}'.format(img.mean().shape)) @@ -221,9 +318,9 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): pth = 'C:/Users/chc/Documents/Data/2018/OliverJonas/180629/' filename = 'L1d1_pos0.h5' dsetname = '/BCARSImage/L1d1_pos0_0/NRB_Post_0' - spect_nrb = _Spectra() - tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename, - dset_list=[dsetname]) + spect_nrb = Spectra() + tester = lazy5.inspect.valid_dsets(pth=pth, file=filename, + dset_list=[dsetname]) out = hdf_import_data(pth, filename, dsetname, spect_nrb) print('HDF_import_data returned: {}'.format(out)) # hdf_process_attr(rosetta, spect_nrb) @@ -232,7 +329,7 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): # print('Shape of dark spectra.mean(): {}'.format(spect_dark.mean().shape)) # print('Dtype of dark spectra: {}'.format(spect_dark._data.dtype)) # print('') - # img = _Hsi() + # img = Hsi() # hdf_import_data(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img) # print('Shape of img: {}'.format(img.shape)) # print('Shape of img.mean(): {}'.format(img.mean().shape)) diff --git a/crikit/io/lazy5/__init__.py b/crikit/io/lazy5/__init__.py new file mode 100644 index 0000000..55fe5fe --- /dev/null +++ b/crikit/io/lazy5/__init__.py @@ -0,0 +1,13 @@ +"""Macros for h5py... because I'm lazy""" + +# ! Inside try-except so setup can still grab the __version__ prior to install +try: + from . import config + from . import utils + from . import inspect + from . import alter + from . import create +except Exception as e: + print(e) + +__version__ = '0.3.0' \ No newline at end of file diff --git a/crikit/io/lazy5/alter.py b/crikit/io/lazy5/alter.py new file mode 100644 index 0000000..ca01635 --- /dev/null +++ b/crikit/io/lazy5/alter.py @@ -0,0 +1,159 @@ +""" Macros for inspection of HDF5 files """ +import h5py as _h5py + +from .utils import (FidOrFile as _FidOrFile, fullpath as _fullpath) +from .nonh5utils import (check_type_compat as _check_type_compat) + +from .config import DefaultConfig +_h5py.get_config().complex_names = DefaultConfig().complex_names + +def alter_attr(dset, attr_key, attr_val, file=None, pth=None, verbose=False, + check_same_type=False, must_exist=False): + """ + Alter attribute dset['attr_key'] with attr_val. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + file/fid must be provided. + + attr_key : str + Attribute name (key) + + attr_val : str + Attribute value to write (replace old) + + file : str or h5py.File + Filename or File-object for open HDF5 file + + pth : str + Path + + verbose : bool + Verbose output to stdout + + check_same_type : bool + Check that the inputs are compatible types as defined in + lazy5.nonh5utils.check_type_compat or lazy5.utils.return_family_type + + must_exist : bool + The attribute must already exist. + + Notes + ----- + None + """ + + if file is not None: + fp = _fullpath(file, pth) + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp, mode='r+') # Read/write, file must exist + fid = fof.fid + if isinstance(dset, str): + dset_object = fid[dset] + elif isinstance(dset, _h5py.Dataset): + if isinstance(file, str): + raise TypeError('Cannot provide h5py.Dataset dset and a filename str.') + dset_object = dset + else: + raise TypeError('dset unknown') + else: + fof = None + if isinstance(dset, _h5py.Dataset): + dset_object = dset + else: + raise TypeError('With no file or fid given, dset must be an h5py.Dataset object') + + if must_exist: + if dset_object.attrs.get(attr_key) is None: + err_str1 = 'Attribute {} does not exist and '.format(attr_key) + raise KeyError(err_str1 + 'must_exist set to True') + + if check_same_type & (dset_object.attrs.get(attr_key) is not None): + if not _check_type_compat(dset_object.attrs[attr_key], attr_val): + err_str1 = 'New attribute value type ({}) '.format(type(attr_val)) + err_str2 = 'must be of the same type as the original ' + err_str3 = '({})'.format(type(dset_object.attrs[attr_key])) + raise TypeError(err_str1 + err_str2 + err_str3) + + if verbose: + if dset_object.attrs.get(attr_key) is None: + print('Attribute {} does not exist. Creating.'.format(attr_key)) + else: + print('Dataset[{}] = {} -> {}'.format(attr_key, dset_object.attrs[attr_key], + attr_val)) + + dset_object.attrs[attr_key] = attr_val + + if fof is not None: + fof.close_if_file_not_fid() + +def alter_attr_same(dset, attr_key, attr_val, file=None, pth=None, verbose=True, + must_exist=False): + """ + Alter attribute dset['attr_key] with attr_val checkint to make sure that + the original and new attribute values are of similar type e.g., int and + np.int32. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + file/fid must be provided. + + attr_key : str + Attribute name (key) + + attr_val : str + Attribute value to write (replace old) + + file : str or h5py.File + Filename or File-object for open HDF5 file + + pth : str + Path + + verbose : bool + Verbose output to stdout + + Notes + ----- + None + """ + return alter_attr(dset, attr_key, attr_val, file, pth, verbose, + check_same_type=True, must_exist=must_exist) + +def write_attr_dict(dset, attr_dict, fid=None, sort_attrs=False, verbose=False): + """ + Write entire dictionary of attrbutes to dataset. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + fid must be provided. + + attr_dict : dict + Attribute dictionary + + fid : h5py.File + If dset is a string, file-object for open HDF5 file must be provided. + + sort_attrs : bool + Sort attribute keys alphabetically prior to writing + + verbose : bool + Verbose output to stdout + """ + + attr_key_list = list(attr_dict) + if sort_attrs: + attr_key_list.sort() + + for attr_key in attr_key_list: + attr_val = attr_dict[attr_key] + alter_attr(dset, attr_key, attr_val, file=fid, verbose=verbose, + check_same_type=False, must_exist=False) + + return True \ No newline at end of file diff --git a/crikit/io/lazy5/config.py b/crikit/io/lazy5/config.py new file mode 100644 index 0000000..fe57c46 --- /dev/null +++ b/crikit/io/lazy5/config.py @@ -0,0 +1,5 @@ +""" Default configuration class """ + +class DefaultConfig: + def __init__(self): + self.complex_names = ('Re', 'Im') \ No newline at end of file diff --git a/crikit/io/lazy5/create.py b/crikit/io/lazy5/create.py new file mode 100644 index 0000000..c545b87 --- /dev/null +++ b/crikit/io/lazy5/create.py @@ -0,0 +1,81 @@ +""" Macros for creation of HDF5 files and/or datasets""" +import h5py as _h5py + +from .config import DefaultConfig +from .utils import (FidOrFile as _FidOrFile, fullpath as _fullpath) +from .inspect import (valid_dsets as _valid_dsets) +from .alter import (write_attr_dict as _write_attr_dict) + +_h5py.get_config().complex_names = DefaultConfig().complex_names + +def save(file, dset, data, pth=None, attr_dict=None, mode='a', + dset_overwrite=False, sort_attrs=False, + chunks=True, verbose=False): + """ + Save an HDF5 file + + Parameters + ---------- + + file : str or h5py.File object (fid) + Filename + + dset : str + Dataset name (including groups if any) + + data : ndarray + Data to write + + pth : str + Path to file. Otherwise, will use present working directory (PWD) + + attr_dict : dict + Attribute dictionary. Will be Ordered. + + mode : str + h5py file mode. + + dset_overwrite : bool + If a dset already exists, overwrite or raise error? + + sort_attrs : bool + Sort the attribute dictionary (alphabetically) prior to saving + + chunks : str or tuple or list + Chunking shape or True for auto-chunking + + verbose : bool + Verbose output + + Returns + ------- + + bool : Saved with no errors + + """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + fof = _FidOrFile(fp, mode=mode) + elif isinstance(file, _h5py.File): + fof = _FidOrFile(file, mode=mode) + else: + raise TypeError('file needs to be a str or h5py.File object.') + + fid = fof.fid + + if not dset_overwrite: + if _valid_dsets(fid, dset, pth=pth, verbose=False): + err_str1 = 'Dataset {} exists. '.format(dset) + err_str2 = 'Param dset_overwrite=False. Will not overwrite' + raise IOError(err_str1 + err_str2) + + dset_id = fid.require_dataset(name=dset, data=data, shape=data.shape, + dtype=data.dtype, chunks=chunks) + + if attr_dict: + _write_attr_dict(dset_id, attr_dict, sort_attrs=sort_attrs) + + fof.close_if_file_not_fid() + + return True diff --git a/crikit/io/lazy5/inspect.py b/crikit/io/lazy5/inspect.py new file mode 100644 index 0000000..7dbf496 --- /dev/null +++ b/crikit/io/lazy5/inspect.py @@ -0,0 +1,288 @@ +""" Macros for inspection of HDF5 files """ +import os as _os +from collections import OrderedDict as _OrderedDict + +import h5py as _h5py +import numpy as _np + +from .utils import (FidOrFile as _FidOrFile, hdf_is_open as _hdf_is_open, + fullpath as _fullpath) + +from .config import DefaultConfig +_h5py.get_config().complex_names = DefaultConfig().complex_names + +__all__ = ['get_groups', 'get_datasets', 'get_hierarchy', + 'get_attrs_dset', 'valid_dsets', 'valid_file'] + +def get_groups(file, pth=None): + """ + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + Notes + ----- + Gets groups in a hierarchical list starting from the base '/'. Thus if + Group2 is INSIDE Group1, it will return Group1, Group1/Group2 -- NOT Group2 + inidividually. + """ + + fp = _fullpath(file, pth) + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + all_items_list = [] + fid.visit(lambda x: all_items_list.append('/{}'.format(x))) + + # list-set-list removes duplicates + grp_list = list(set([item for item in all_items_list if isinstance(fid[item], _h5py.Group)])) + + grp_list.append('/') # Add in base level group + grp_list.sort() + + fof.close_if_file_not_fid() + + return grp_list + +def get_datasets(file, pth=None, fulldsetpath=True): + """ + Parameters + ---------- + + file : str or _h5py.File + Filename or File-object for open HDF5 file + + fulldsetpath : bool + Return just the dataset names with group names or not. + """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + fof = _FidOrFile(fp) + + else: + fof = _FidOrFile(file) + + fid = fof.fid + + all_items_list = [] + fid.visit(lambda x: all_items_list.append('/{}'.format(x))) + dset_list = [] + + # list-set-list removes duplicates + dset_list = list(set([item for item in all_items_list if isinstance(fid[item], _h5py.Dataset)])) + dset_list.sort() + + if not fulldsetpath: + for num, dset in enumerate(dset_list): + split_out = dset.rsplit('/', maxsplit=1) + if len(split_out) == 1: + pass + else: + dset_list[num] = split_out[-1] + + fof.close_if_file_not_fid() + + return dset_list + +def get_hierarchy(file, pth=None, fulldsetpath=False, grp_w_dset=False): + """ + Return an ordered dictionary, where the keys are groups and the items are + the datasets + + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + fulldsetpath : bool + If True, a dataset name will be prepended with the group down to the + base level, '/'. If False, it will just be the dset name. + + grp_w_dset : bool + If True, only return groups that contain datasets. If False, include + empty groups + + Returns + ------- + OrderedDict : (group, [dataset list]) + Group and dataset names + + """ + fp = _fullpath(file, pth) + + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + grp_list = get_groups(fid) + dset_list = get_datasets(fid, fulldsetpath=True) + + grp_dict = _OrderedDict([[grp, []] for grp in grp_list]) + + for dset in dset_list: + split_out = dset.rsplit('/', maxsplit=1) + if (len(split_out) == 1) or (split_out[0] == ''): + if dset[0] == '/': + grp_dict['/'].append(dset[1:]) + else: + grp_dict['/'].append(dset) + else: + if fulldsetpath: + grp_dict[split_out[0]].append(dset) + else: + grp_dict[split_out[0]].append(split_out[1]) + + # Only keep groups with datasets + if grp_w_dset: + to_pop = [] + for k in grp_dict: + if not grp_dict[k]: # is empty + to_pop.append(k) + + for empty_grp in to_pop: + grp_dict.pop(empty_grp) + + fof.close_if_file_not_fid() + + return grp_dict + +def get_attrs_dset(file, dset, pth=None, convert_to_str=True, convert_sgl_np_to_num=False): + """ + Get dictionary of attribute values for a given dataset + + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + dset : str + Full dataset name with preprended group names. E.g., '/Group1/Dataset' + + convert_to_str : bool + If an attribute is a numpy.bytes_ string-like object, but not a str, try + to decode into utf-8. + + convert_sgl_np_to_num : bool + If an attribute is a numpy array with a single entry, convert to non-numpy + numeric type. E.g. np.array([1.0]) -> 1.0 + + Returns + ------- + OrderedDict : (key, value) + + """ + fp = _fullpath(file, pth) + + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + ds_attrs = fid[dset].attrs + + attr_keys_list = list(ds_attrs) + attr_keys_list.sort() + + attr_list = [] + for k in attr_keys_list: + try: + attr_val = ds_attrs[k] + except (TypeError, ValueError): + print('Could not get value for attribute: {}. Set to None'.format(k)) + attr_list.append([k, None]) + else: + if isinstance(attr_val, _np.ndarray): + if (isinstance(attr_val, _np.bytes_) | (attr_val.dtype.type == _np.bytes_)) & convert_to_str: # pylint: disable=no-member + # * tostring() added in \x00 to end of string; thus, used list comprehension + np_byte_to_str = [q for q in attr_val][0].decode() + attr_list.append([k, np_byte_to_str]) + elif (_np.issubdtype(attr_val.dtype, _np.number) & (attr_val.size == 1)) & convert_sgl_np_to_num: + attr_list.append([k, attr_val.item()]) + else: + attr_list.append([k, attr_val]) + elif isinstance(attr_val, bytes) & convert_to_str: + attr_list.append([k, attr_val.decode()]) + else: + attr_list.append([k, attr_val]) + + attr_dict = _OrderedDict(attr_list) + + fof.close_if_file_not_fid() + + return attr_dict + +def valid_file(file, pth=None, verbose=False): + """ Validate whether a file exists (or if a fid, is-open """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + isvalid = _os.path.isfile(fp) + + if verbose: + if isvalid: + print('{} is a valid file.'.format(fp)) + else: + print('{} is a not valid file.'.format(fp)) + + elif isinstance(file, _h5py.File): + isvalid = _hdf_is_open(file) + else: + raise TypeError('file need be of type str or h5py.File object.') + + return isvalid + +def valid_dsets(file, dset_list, pth=None, verbose=False): + """ Check whether 1 or more datasets are valid """ + + def _add_leading_slash(str_to_check): + """ Return string sans leading '/' if there is one """ + if str_to_check[0] == '/': + return str_to_check + else: + return '/' + str_to_check + + file_is_valid = valid_file(file, pth=pth, verbose=verbose) + + if not file_is_valid: + return False + + dset_in_file = get_datasets(file, pth=pth, fulldsetpath=True) + + if isinstance(dset_list, (list, tuple)): + hits = 0 + for dset in dset_list: + dset_to_test = _add_leading_slash(dset) + if dset_in_file.count(dset_to_test) > 0: + hits += 1 + if verbose: + print('{} : VALID'.format(dset_to_test)) + else: + if verbose: + print('{} : NOT VALID'.format(dset_to_test)) + if hits == len(dset_list): + if verbose: + print('All datasets are valid') + return True + else: + if verbose: + print('Some or all datasets are NOT valid') + return False + elif isinstance(dset_list, str): + if dset_in_file.count(_add_leading_slash(dset_list)) > 0: + if verbose: + print('{} : VALID'.format(dset_list)) + return True + else: + if verbose: + print('{} : NOT VALID'.format(dset_list)) + return False + else: + err_str1 = 'dset_list: {} of type {} '.format(dset_list, type(dset_list)) + err_str2 = 'is not a str, list, or tuple' + raise TypeError(err_str1 + err_str2) + diff --git a/crikit/io/lazy5/nonh5utils.py b/crikit/io/lazy5/nonh5utils.py new file mode 100644 index 0000000..4ee2c98 --- /dev/null +++ b/crikit/io/lazy5/nonh5utils.py @@ -0,0 +1,97 @@ +""" Non-HDF5 utility functions """ +import copy as _copy +from collections import OrderedDict as _OrderedDict + +import numpy as _np + +__all__ = ['filterlist', 'check_type_compat', 'return_family_type'] + +def filterlist(in_list, filters, keep_filtered_items=True, exclusive=True): + """ + Parameters + ---------- + in_list : list + List of strings to filter + + filters : str, list, tuple + Find filters (or entries of filters) in in_list + + keep_filtered_items : bool + Returns entries from in_list that DO have filters (INCLUDE filter). + If False, EXCLUDE filter + + exclusive : bool + Filter is exclusive, i.e. includes/excludes in_list entries that + have ALL filters. Otherwise, non-exclusive and any entry with A + filter are excluded/included. + + Returns + ------- + list : filtered list + + """ + if isinstance(filters, (tuple, list)): + filter_list = filters + elif isinstance(filters, str): + filter_list = [filters] + else: + raise TypeError('filters must be of type str, tuple, or list') + + def condition(keep_it, item): + """ Keep or don't keep item depending on keep_it bool """ + if keep_it: + return item + else: + return not item + + if exclusive: + out_list = _copy.deepcopy(in_list) + for current_filt in filter_list: + out_list = [entry for entry in out_list if condition(keep_filtered_items, + entry.count(current_filt))] + else: + out_list = [] + for current_filt in filter_list: + out_list.extend([entry for entry in in_list if condition(keep_filtered_items, + entry.count(current_filt))]) + # Removes duplicates + out_list = list(_OrderedDict.fromkeys(out_list)) + + return out_list + +def check_type_compat(input_a, input_b): + """ + Check the compatibility of types. E.g. np.float32 IS compatible with + float + """ + return return_family_type(input_a) is return_family_type(input_b) + +def return_family_type(input_a): + """ Return family of type input_a. int, float, complex, str, bytes, bool """ + a_type = None + + # Have to do numpy first, bc np.str_ is subtype of str also + if isinstance(input_a, _np.generic): # Is input_a numpy-type + if isinstance(input_a, _np.bool_): + a_type = bool + elif isinstance(input_a, _np.bytes_): # pylint: disable=E1101 + a_type = bytes + elif isinstance(input_a, _np.str_): # pylint: disable=E1101 + a_type = str + elif isinstance(input_a, _np.integer): + a_type = int + elif isinstance(input_a, _np.floating): # pylint: disable=E1101 + a_type = float + elif isinstance(input_a, _np.complexfloating): # pylint: disable=E1101 + a_type = complex + elif isinstance(input_a, _np.ndarray): + # Cute trick: Send 1 as type from the dtype for testing + a_type = return_family_type(input_a.dtype.type(1)) + elif isinstance(input_a, (int, float, complex, str, bytes, bool)): + a_type = type(input_a) + + if a_type is None: + err_str1 = 'input_a is not int, float, str, or bool; ' + raise TypeError(err_str1 + 'or a numpy-equivalent: {}'.format(type(input_a))) + + return a_type diff --git a/crikit/io/lazy5/tests/__init__.py b/crikit/io/lazy5/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/crikit/io/lazy5/tests/test_alter.py b/crikit/io/lazy5/tests/test_alter.py new file mode 100644 index 0000000..e56004f --- /dev/null +++ b/crikit/io/lazy5/tests/test_alter.py @@ -0,0 +1,347 @@ +""" Test inspection of HDF5 files """ +import os +import time + +from collections import OrderedDict as _OrderedDict + +import h5py +import pytest + +import numpy as np + +from crikit.io.lazy5.utils import hdf_is_open +from crikit.io.lazy5.alter import alter_attr_same, alter_attr, write_attr_dict + +@pytest.fixture(scope="function") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename)) + + +def test_attr_alter_same(hdf_dataset): + """ Try altering an attribute with the same type of value type """ + + _, fid = hdf_dataset + dset_obj = fid['base'] + attr_obj = dset_obj.attrs + + # Try new attrbute + orig_key = 'Attribute_new' + new_val = 'Test2' + alter_attr_same(dset_obj, orig_key, new_val) + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_new2' + new_val = 'Test2' + with pytest.raises(KeyError): + alter_attr_same(dset_obj, orig_key, new_val, must_exist=True) + + # Try same-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = b'Test2' + # alter_attr_same(dset_obj, orig_key, new_val) + # assert orig_val != attr_obj[orig_key] + # assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = np.bytes_('Test2') # pylint: disable=E1101 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2.2 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4, 5, 6]) + alter_attr_same(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8, 9], [10, 11, 12]]) + alter_attr_same(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try DIFFERENT-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 1 + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = 'Test2' + # with pytest.raises(TypeError): + # alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = True + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2 + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4.1, 5.1, 6.1]) + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8.1, 9], [10, 11, 12.1]]) + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + +def test_attr_alter(hdf_dataset): + """ Try altering an attribute with the same or different type of value""" + + filename, fid = hdf_dataset + dset_obj = fid['base'] + attr_obj = dset_obj.attrs + + # Try new attrbute (dset_obj) + orig_key = 'Attribute_new' + new_val = 'Test2' + assert attr_obj.get(orig_key) is None + alter_attr(dset_obj, orig_key, new_val) + assert attr_obj[orig_key] == new_val + + # Try new attrbute (dset_obj) + orig_key = 'Attribute_new2' + new_val = 'Test2' + assert attr_obj.get(orig_key) is None + with pytest.raises(TypeError): + alter_attr([], orig_key, new_val, file=fid) + alter_attr(dset_obj, orig_key, new_val, file=fid) + assert attr_obj[orig_key] == new_val + + # Try new attrbute (given filename) + orig_key = 'Attribute_new3' + new_val = 'Test3' + with pytest.raises(TypeError): + alter_attr(dset_obj, orig_key, new_val, file=filename) + alter_attr('base', orig_key, new_val, file=filename) + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_new4' + new_val = 'Test2' + with pytest.raises(KeyError): + alter_attr(dset_obj, orig_key, new_val, must_exist=True) + + # Try same-type writes + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = b'Test2' + # alter_attr(dset_obj, orig_key, new_val) + # assert orig_val != attr_obj[orig_key] + # assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = np.bytes_('Test2') # pylint: disable=E1101 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2.2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4, 5, 6]) + alter_attr(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8, 9], [10, 11, 12]]) + alter_attr(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try DIFFERENT-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 1 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = True + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4.1, 5.1, 6.1]) + alter_attr(dset_obj, orig_key, new_val) + assert not np.allclose(orig_val, attr_obj[orig_key]) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8.1, 9], [10, 11, 12.1]]) + alter_attr(dset_obj, orig_key, new_val) + assert not np.allclose(orig_val, attr_obj[orig_key]) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try providing dset as str but no file + orig_key = 'Attribute_int' + new_val = 3 + with pytest.raises(TypeError): + alter_attr('base', orig_key, new_val) + +def test_write_attr_dict(hdf_dataset): + """ Try writing dictionary of attributes """ + + filename, fid = hdf_dataset + dset_obj = fid['base'] + + attr_dict = _OrderedDict([['WDA2', 2], ['WDA1', 1]]) + + # Write via dset obj + assert write_attr_dict(dset_obj, attr_dict, fid=None, sort_attrs=False, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + assert dset_obj.attrs['Attribute_str'] == 'Test' + l_attr = list(dset_obj.attrs.keys()) + + # Order should be that written + l_attr[-2] == 'WDA2' + l_attr[-1] == 'WDA1' + + # Write via dset str MISSING fid + with pytest.raises(TypeError): + write_attr_dict('base', attr_dict, fid=None, sort_attrs=False, verbose=False) + + # Write via dset str + assert write_attr_dict('base', attr_dict, fid=fid, sort_attrs=False, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + assert dset_obj.attrs['Attribute_str'] == 'Test' + + # Write via dset str and SORT attr + assert write_attr_dict('base', attr_dict, fid=fid, sort_attrs=True, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + + # Order should be sorted. WDA* are the last alphanumerically in this test file + l_attr = list(dset_obj.attrs.keys()) + l_attr[-1] == 'WDA2' + l_attr[-2] == 'WDA1' \ No newline at end of file diff --git a/crikit/io/lazy5/tests/test_create.py b/crikit/io/lazy5/tests/test_create.py new file mode 100644 index 0000000..51fe82e --- /dev/null +++ b/crikit/io/lazy5/tests/test_create.py @@ -0,0 +1,103 @@ +""" Test creation of HDF5 files """ +import os +import time + +import pytest + +import numpy as np +import h5py + +from crikit.io.lazy5.create import save +from crikit.io.lazy5.utils import FidOrFile + + +def test_save_no_attrs(): + data = np.random.randn(20,20) + filename = 'temp_create.h5' + dset_name = '/Group1/Dset' + save(filename, dset_name, data, mode='w') + + fof = FidOrFile(filename) + fid = fof.fid + assert np.allclose(fid[dset_name], data) + fof.close_if_file_not_fid() + + # Test re-write + data = np.random.randn(20,20) + save(filename, dset_name, data, mode='w') + fof = FidOrFile(filename) + fid = fof.fid + assert np.allclose(fid[dset_name], data) + fof.close_if_file_not_fid() + + # Test re-write when overwrite of dset set to False + data = np.random.randn(20,20) + with pytest.raises(IOError): + save(filename, dset_name, data, dset_overwrite=False) + + # Test re-write with attributes + data = np.random.randn(20,20) + attr_dict = {'AT1':1, 'AT2':2} + save(filename, dset_name, data, attr_dict=attr_dict, mode='w') + + fof = FidOrFile(filename) + fid = fof.fid + assert fid[dset_name].attrs['AT1'] == 1 + assert fid[dset_name].attrs['AT2'] == 2 + with pytest.raises(KeyError): + fid[dset_name].attrs['DOESNOTEXIST'] == 2 + + fof.close_if_file_not_fid() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename)) + + +def test_save_diff_path(): + data = np.random.randn(20,20) + filename = 'temp_create2.h5' + dset_name = '/Group1/Dset' + + pth = './temp_test' + os.mkdir(pth) + + save(filename, dset_name, data, pth=pth, mode='w') + + fp = os.path.join(pth, filename) + + assert os.path.isdir(pth) + assert os.path.isfile(fp) + assert os.path.getsize(fp) >= data.nbytes + + os.remove(fp) + os.rmdir(pth) + +def test_save_to_open_h5_file(): + """ Test saving to an H5 file where the H5 file id is passed """ + + data = np.random.randn(20,20) + filename = 'temp_create2.h5' + dset_name = '/Group1/Dset' + + pth = './temp_test' + os.mkdir(pth) + assert os.path.isdir(pth) + + fp = os.path.join(pth, filename) + with h5py.File(fp, 'w') as fid: + save(fid, dset_name, data, pth=pth, mode='w') + + assert os.path.isfile(fp) + assert os.path.getsize(fp) >= data.nbytes + + os.remove(fp) + os.rmdir(pth) + +def test_save_to_open_wrong_type(): + """ Test saving to an inappripriate input (not string or h5 file fid) """ + + with pytest.raises(TypeError): + save(123, 'Name', np.random.rand(10,10), pth=None, mode='w') diff --git a/crikit/io/lazy5/tests/test_inspect.py b/crikit/io/lazy5/tests/test_inspect.py new file mode 100644 index 0000000..fba3297 --- /dev/null +++ b/crikit/io/lazy5/tests/test_inspect.py @@ -0,0 +1,348 @@ +""" Test inspection of HDF5 files """ +import os +import time + +import h5py +import pytest + +import numpy as np +from numpy.testing import assert_array_almost_equal + +from crikit.io.lazy5.inspect import (get_groups, get_datasets, get_hierarchy, + get_attrs_dset, valid_dsets, valid_file) + +from crikit.io.lazy5.utils import hdf_is_open + +@pytest.fixture(scope="module") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs['Attribute_np_bytes_inarray'] = np.array(b'Test') # pylint: disable=no-member + fid['base'].attrs['Attribute_np_bytes_inarray2'] = np.array([b'Test']) # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + fid['base'].attrs.create('Attribute_np_sgl_int', np.array([1])) + fid['base'].attrs.create('Attribute_np_sgl_float', np.array([1.0])) + fid['base'].attrs.create('Attribute_np_array_float', np.array([1.0, 2.0])) + fid['base'].attrs.create('Attribute_np_sgl_complex', np.array([1.0 + 1j])) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename)) + +def test_valid_file(hdf_dataset): # pylint:disable=redefined-outer-name + """ Test whether a file is valid or not """ + + filename, fid = hdf_dataset + + assert valid_file(filename, verbose=True) + assert not valid_file('NOT_A_REAL_FILE.XYZ', verbose=True) + +def test_valid_dsets(hdf_dataset): # pylint:disable=redefined-outer-name + """ Test whether a dset or list of dsets are valid or not """ + + filename, fid = hdf_dataset + + # NOT valid filename + assert not valid_dsets('NOTAFILE.XYZ', 'base', verbose=True) + + # Single dataset + dset_list = 'base' + assert valid_dsets(filename, dset_list, verbose=True) + + # Single dataset by fid + dset_list = 'base' + assert valid_dsets(fid, dset_list, verbose=True) + + # Single dataset is WRONG + dset_list = 'NOTADSET' + assert not valid_dsets(filename, dset_list, verbose=True) + + # Single dataset in list + dset_list = ['base'] + assert valid_dsets(filename, dset_list, verbose=True) + + # Datasets in list -- NOTE some have leading slashes, some don't + dset_list = ['base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + 'Group2/ingroup2'] + assert valid_dsets(filename, dset_list, verbose=True) + + # Datasets in list -- 1 IS WRONG + dset_list = ['base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + 'Group2/DOESNOTEXIST'] + assert not valid_dsets(filename, dset_list, verbose=True) + + # Dataset with wrong-type + dset_list = 1 + with pytest.raises(TypeError): + valid_dsets(filename, dset_list, verbose=True) + + # Dataset with wrong-type + dset_list = ['base', 1] + with pytest.raises(TypeError): + valid_dsets(filename, dset_list, verbose=True) + +def test_get_groups(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's group list """ + + filename, fid = hdf_dataset + + # Passing fid + grp_list = get_groups(fid) + assert set(grp_list) == {'/', '/Group1', '/Group2', '/Group2/Group3', '/Group4', '/Group4/Group5', + '/Group4/Group5/Group6'} + + # Passing filename + grp_list = get_groups(filename) + assert set(grp_list) == {'/', '/Group1', '/Group2', '/Group2/Group3', '/Group4', '/Group4/Group5', + '/Group4/Group5/Group6'} + +def test_get_datasets_fullpath(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with groupnames prepended""" + filename, fid = hdf_dataset + + # Passing fid + dataset_list = get_datasets(fid, fulldsetpath=True) + assert set(dataset_list) == {'/base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + '/Group2/ingroup2', '/Group2/Group3/ingroup3', + '/Group4/Group5/Group6/ingroup6'} + + # Passing filename + dataset_list = get_datasets(filename, fulldsetpath=True) + assert set(dataset_list) == {'/base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + '/Group2/ingroup2', '/Group2/Group3/ingroup3', + '/Group4/Group5/Group6/ingroup6'} + +def test_get_datasets_nopath(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with no groupnames prepended """ + filename, fid = hdf_dataset + + # Passing fid + dataset_list = get_datasets(fid, fulldsetpath=False) + assert set(dataset_list) == {'base', 'ingroup1_1', 'ingroup1_2', 'ingroup2', + 'ingroup3', 'ingroup6'} + + # Passing filename + dataset_list = get_datasets(filename, fulldsetpath=False) + assert set(dataset_list) == {'base', 'ingroup1_1', 'ingroup1_2', 'ingroup2', + 'ingroup3', 'ingroup6'} + +def test_get_hierarchy_fullpath(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing with full paths in + the dataset names. Keys are groups, values are datasets. + """ + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=True, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=True, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + +def test_get_hierarchy_grp_w_dset(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing empty sets are NOT + returned. Keys are groups, values are datasets. + """ + + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=True, grp_w_dset=True) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=True, grp_w_dset=True) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + +def test_get_hierarchy_nopath(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing with no full paths in + the dataset names. Keys are groups, values are datasets. + """ + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=False, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['ingroup1_1', 'ingroup1_2'], + '/Group2':['ingroup2'], + '/Group2/Group3':['ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['ingroup6'] + } + + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=False, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['ingroup1_1', 'ingroup1_2'], + '/Group2':['ingroup2'], + '/Group2/Group3':['ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['ingroup6']} + + +def test_get_dset_attrs(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with groupnames prepended""" + + filename, fid = hdf_dataset + + # Passing fid + # DO NOT CONVERT-to-STR + dset_attrs = get_attrs_dset(fid, 'base', convert_to_str=False) + assert dset_attrs['Attribute_str'] == 'Test' + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # assert dset_attrs['Attribute_bytes'] == b'Test' + + assert dset_attrs['Attribute_np_bytes'] == b'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == b'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == b'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # DO CONVERT-to-STR + dset_attrs = get_attrs_dset(fid, 'base', convert_to_str=True) + assert dset_attrs['Attribute_str'] == 'Test' + assert dset_attrs['Attribute_bytes'] == 'Test' + assert dset_attrs['Attribute_np_bytes'] == 'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == 'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == 'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # Passing filename + # DO NOT CONVERT-to-STR + dset_attrs = get_attrs_dset(filename, 'base', convert_to_str=False) + assert dset_attrs['Attribute_str'] == 'Test' + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # assert dset_attrs['Attribute_bytes'] == b'Test' + + assert dset_attrs['Attribute_np_bytes'] == b'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == b'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == b'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # DO CONVERT-to-STR + dset_attrs = get_attrs_dset(filename, 'base', convert_to_str=True) + assert dset_attrs['Attribute_str'] == 'Test' + assert dset_attrs['Attribute_bytes'] == 'Test' + assert dset_attrs['Attribute_np_bytes'] == 'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == 'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == 'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # CONVERT Single Numpy Value to Numeric + dset_attrs = get_attrs_dset(filename, 'base', convert_sgl_np_to_num=True) + assert dset_attrs['Attribute_np_sgl_int'] == 1 + assert isinstance(dset_attrs['Attribute_np_sgl_int'], int) + assert not isinstance(dset_attrs['Attribute_np_sgl_int'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_float'] == 1.0 + assert isinstance(dset_attrs['Attribute_np_sgl_float'], float) + assert not isinstance(dset_attrs['Attribute_np_sgl_float'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_complex'] == 1.0 + 1j + assert isinstance(dset_attrs['Attribute_np_sgl_complex'], complex) + assert not isinstance(dset_attrs['Attribute_np_sgl_complex'], np.ndarray) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + assert isinstance(dset_attrs['Attribute_np_array_float'], np.ndarray) + + # DO NOT CONVERT Single Numpy Value to Numeric + dset_attrs = get_attrs_dset(filename, 'base', convert_sgl_np_to_num=False) + assert dset_attrs['Attribute_np_sgl_int'] == 1 + assert not isinstance(dset_attrs['Attribute_np_sgl_int'], int) + assert isinstance(dset_attrs['Attribute_np_sgl_int'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_float'] == 1.0 + assert not isinstance(dset_attrs['Attribute_np_sgl_float'], float) + assert isinstance(dset_attrs['Attribute_np_sgl_float'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_complex'] == 1.0 + 1j + assert not isinstance(dset_attrs['Attribute_np_sgl_complex'], complex) + assert isinstance(dset_attrs['Attribute_np_sgl_complex'], np.ndarray) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + assert isinstance(dset_attrs['Attribute_np_array_float'], np.ndarray) \ No newline at end of file diff --git a/crikit/io/lazy5/tests/test_nonh5utils.py b/crikit/io/lazy5/tests/test_nonh5utils.py new file mode 100644 index 0000000..2428c5e --- /dev/null +++ b/crikit/io/lazy5/tests/test_nonh5utils.py @@ -0,0 +1,130 @@ +""" Test non-HDF-related utilities """ +import pytest + +import numpy as np + +import crikit.io.lazy5 as lazy5 +from crikit.io.lazy5.nonh5utils import (filterlist, check_type_compat, return_family_type) + +def test_filter_list(): + """ Test filtering of lists """ + list_to_filter = ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1', 'Exclude2'] + + # Keep, filter=str, exclusive + filters = 'Keep' + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Exclude, filter=str, exclusive + filters = 'Exclude' + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=True) + assert out_list == ['Keep1', 'Keep2'] + + # Keep, filter=list, exclusive + filters = ['Keep'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Keep, filter=tuple, exclusive + filters = ('Keep') + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Keep, filter=list, exclusive + filters = ['Keep', '1'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1'] + + # Keep, filter=list, NOT-exclusive + filters = ['Keep', '1'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=False) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1'] + + # Exclude, filter=list, exclusive + filters = ['Exclude', '2'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=True) + assert out_list == ['Keep1'] + + # Exclude, filter=list, NON-exclusive + filters = ['Exclude', '2'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=False) + + assert out_list == ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1'] + + # Wrong type of filter + filters = 1 + with pytest.raises(TypeError): + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=False) + +def test_return_family_type(): + """ Test return_family_type """ + assert return_family_type(1) is int + assert return_family_type(1.1) is float + assert return_family_type(1 + 1j*3) is complex + assert return_family_type('Test') is str + assert return_family_type(b'Test') is bytes + assert return_family_type(True) is bool + + assert return_family_type(np.int32(1)) is int + assert return_family_type(int(1)) is int + assert return_family_type(np.float32(1.1)) is float + assert return_family_type(float(1.1)) is float + assert return_family_type(np.complex64(1 + 1j*3)) is complex + assert return_family_type(complex(1 + 1j*3)) is complex + assert return_family_type(str('Test')) is str + assert return_family_type(np.str_('Test')) is str # pylint: disable=E1101 + assert return_family_type(np.bytes_('Test')) is bytes # pylint: disable=E1101 + assert return_family_type(bool(True)) is bool + assert return_family_type(np.bool_(True)) is bool + + with pytest.raises(TypeError): + return_family_type([1, 2, 3]) + + with pytest.raises(TypeError): + return_family_type((1, 2, 3)) + + with pytest.raises(TypeError): + return_family_type({'a':1}) + + +def test_check_type_compat(): + """ Test check_type_compat[ibility] """ + + # Positive tests + assert check_type_compat(1, 2) + assert check_type_compat(1.1, 2.1) + assert check_type_compat(1.1+1j*3, 2.1+1j*8) + assert check_type_compat('Test', 'Test2') + assert check_type_compat(b'Test', b'Test2') + assert check_type_compat(True, False) + + assert check_type_compat(1, np.int32(2)) + assert check_type_compat(1.1, np.float32(2.1)) + assert check_type_compat(1.1+1j*3, np.complex64(2.1+1j*8)) + assert check_type_compat('Test', np.str_('Test2')) # pylint: disable=E1101 + assert check_type_compat(b'Test', np.bytes_('Test2')) # pylint: disable=E1101 + assert check_type_compat(True, np.bool_(False)) + + # Negative checks + assert not check_type_compat(1, 2.1) + assert not check_type_compat(1.1, 2) + assert not check_type_compat(1.1+1j*3, 2.1) + assert not check_type_compat('Test', 1) + assert not check_type_compat('Test', b'Test2') + assert not check_type_compat(True, 1) + + assert not check_type_compat(1.1, np.int32(2)) + assert not check_type_compat(1, np.float32(2.1)) + assert not check_type_compat(1, np.complex64(2.1+1j*8)) + assert not check_type_compat(1, np.str_('Test2')) # pylint: disable=E1101 + assert not check_type_compat('Test', np.bytes_('Test2')) # pylint: disable=E1101 + assert not check_type_compat(1, np.bool_(False)) diff --git a/crikit/io/lazy5/tests/test_ui.py b/crikit/io/lazy5/tests/test_ui.py new file mode 100644 index 0000000..1d6592a --- /dev/null +++ b/crikit/io/lazy5/tests/test_ui.py @@ -0,0 +1,163 @@ +""" Test inspection of HDF5 files """ +import os +import sys +import h5py + +import numpy as np +import pytest + +try: + from PyQt5.QtWidgets import QApplication + from PyQt5.QtTest import QTest + import PyQt5.QtCore + from PyQt5.QtCore import Qt +except Exception: + HAS_PYQT5 = False +else: + HAS_PYQT5 = True + import crikit.io.lazy5 as lazy5 + from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad + +from crikit.io.lazy5.utils import hdf_is_open + +@pytest.mark.skipif(not HAS_PYQT5, reason='PyQt5 not installed, skipping.') +class TestUI: + """ Test the HDF5 PyQt5 Viewer """ + + @pytest.fixture(scope="module") + def hdf_dataset(self): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test_ui.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + + app = QApplication(sys.argv) # pylint: disable=C0103, W0612 + yield filename + + # Tear-down + if hdf_is_open(fid): + fid.close() + os.remove(filename) + # sys.exit() + + def test_ui_win_title_empty_load_dataset(self, hdf_dataset): + """ Test whether load dataset dialog is titled properly with no title provided""" + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + assert dialog.windowTitle() == 'Select a dataset...' + + def test_ui_win_title_load_dataset(self, hdf_dataset): + """ Test whether load dataset dialog is titled properly """ + self.filename = hdf_dataset + dialog = HdfLoad(title='TEST') + _ = dialog.fileOpen(self.filename) + + assert dialog.windowTitle() == 'TEST: Select a dataset...' + + def test_ui_load_file(self, hdf_dataset): + """ Load test file and check groups """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + + list_grps = [dialog.ui.comboBoxGroupSelect.itemText(num) for num in + range(dialog.ui.comboBoxGroupSelect.count())] + + assert list_dsets == ['base'] + assert '/Group1' in list_grps + assert '/Group2/Group3' in list_grps + assert '/Group4/Group5/Group6' in list_grps + assert '/Group5' not in list_grps + + def test_ui_change_grp_and_filter_include(self, hdf_dataset): + """ Load test file, change to Group1, filter for _1 """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(1) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/Group1' + assert list_dsets == ['ingroup1_1', 'ingroup1_2'] + + dialog.ui.filterIncludeString.setText('_1') + QTest.mouseClick(dialog.ui.pushButtonFilter, Qt.LeftButton) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert list_dsets == ['ingroup1_1'] + + def test_ui_change_grp_and_filter_exclude(self, hdf_dataset): + """ Load test file, change to Group1, filter for _1 """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(1) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/Group1' + assert list_dsets == ['ingroup1_1', 'ingroup1_2'] + + dialog.ui.filterExcludeString.setText('_1') + QTest.mouseClick(dialog.ui.pushButtonFilter, Qt.LeftButton) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert list_dsets == ['ingroup1_2'] + + def test_ui_attrs(self, hdf_dataset): + """ Load test file, change to base group (/), check attributes """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(0) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/' + assert list_dsets == ['base'] + + # Select dataset base + dialog.ui.listDataSet.item(0).setSelected(True) + QTest.mouseClick(dialog.ui.listDataSet.viewport(), Qt.LeftButton) + + assert (dialog.ui.tableAttributes.findItems('Attribute_str', Qt.MatchExactly)[0].text() == + 'Attribute_str') + assert not dialog.ui.tableAttributes.findItems('fake', Qt.MatchExactly) # Empty + + def test_ui_wrongfile(self, hdf_dataset): + """ Load test file, change to base group (/), check attributes """ + self.filename = hdf_dataset + dialog = HdfLoad() + with pytest.raises(FileNotFoundError): + _ = dialog.fileOpen('does_not_exist.h5') diff --git a/crikit/io/lazy5/tests/test_utils.py b/crikit/io/lazy5/tests/test_utils.py new file mode 100644 index 0000000..506fac7 --- /dev/null +++ b/crikit/io/lazy5/tests/test_utils.py @@ -0,0 +1,106 @@ +""" Test HDF-related utilities """ +import os + +import pytest + +import h5py +import numpy as np + +import crikit.io.lazy5 as lazy5 +from crikit.io.lazy5.utils import (FidOrFile, hdf_is_open, fullpath) + +@pytest.fixture(scope="module") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test_utils.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + fid.create_dataset('base', data=data) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + os.remove(filename) + +def test_fid_or_file_filename_provided(hdf_dataset): + """ Test FidOrFile Class with provided filename """ + filename, _ = hdf_dataset + + fof = FidOrFile(filename) + + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + assert fof.fid is not None + assert not fof.is_fid + + fof.fid.close() + +def test_fid_or_file_fid_provided(hdf_dataset): + """ Test FidOrFile Class with provided fid """ + _, fid = hdf_dataset + + fof = FidOrFile(fid) + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + assert fof.fid is not None + assert fof.is_fid + +def test_fid_or_file_close_if_not_fid(hdf_dataset): + """ Test close if filename was provided """ + filename, fid = hdf_dataset + + fof = FidOrFile(fid) + fof.close_if_file_not_fid() + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + + fof = FidOrFile(filename) + fof.close_if_file_not_fid() + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 0 + +def test_hdf_is_open(hdf_dataset): + """ Test hdf_is_open function """ + _, fid = hdf_dataset + + assert hdf_is_open(fid) + fid.close() + + assert not hdf_is_open(fid) + +def test_fullpath(): + """ Test full path """ + fp = fullpath(filename=None,pth=None) + assert fp is None + + fn = 'test.XYZ' + p = 'Dir1/Dir2' + + fp = fullpath(filename=fn,pth=None) + assert fp == fn + + fp = fullpath(filename=fn, pth=p) + assert fp == os.path.join(p, fn) \ No newline at end of file diff --git a/crikit/io/lazy5/ui/QtHdfLoad.py b/crikit/io/lazy5/ui/QtHdfLoad.py new file mode 100644 index 0000000..3f3713c --- /dev/null +++ b/crikit/io/lazy5/ui/QtHdfLoad.py @@ -0,0 +1,242 @@ +""" +HDF5 LOAD DATA QDialog (crikit.vis.subguis.h5loadgui) +======================================================= + + H5LoadGUI : A graphical user interface (GUI) to select HDF5 dataset(s) + + Method : H5LoadGUI.getFileDataSets() + + Return (tuple) : (path [str], filename [str], dataset(s) [list], selection_made [bool]) + + Notes + ----- + Methods that interact with Qt follow the Qt naming convention: + firstSecondThird +""" + + +# Append sys path +import sys as _sys +import os as _os + +try: + # Generic imports for QT-based programs + from PyQt5.QtWidgets import (QApplication as _QApplication, \ + QDialog as _QDialog, QFileDialog as _QFileDialog, \ + QTableWidgetItem as _QTableWidgetItem) +except Exception: + HAS_PYQT5 = False +else: + HAS_PYQT5 = True +from crikit.io.lazy5.ui.qt_HdfLoad import Ui_Dialog + +from crikit.io.lazy5.inspect import get_hierarchy, get_attrs_dset +from crikit.io.lazy5.nonh5utils import filterlist + +class HdfLoad(_QDialog): ### EDIT ### + """ GUI Loader Class for H5 Files """ + + # Default configuration + config = {'only_show_grp_w_dset': True, # Only show groups with datasets + 'attr_description': 'Memo', # Description attribute key (optional) + 'excl_filtering' : True # Filtering is exclusive (filters are AND'd) + } + + def __init__(self, title=None, parent=None): + + # Generic load/init designer-based GUI + super(HdfLoad, self).__init__(parent) + self.ui = Ui_Dialog() # pylint: disable=C0103 + self.ui.setupUi(self) + + self.path = None + self.filename = None + self.all_selected = None + self.group_dset_dict = None + + if title: + self.setWindowTitle('{}: Select a dataset...'.format(title)) + else: + self.setWindowTitle('Select a dataset...') + + self.ui.pushButtonOk.clicked.connect(self.accept) + self.ui.pushButtonCancel.clicked.connect(self.reject) + self.ui.comboBoxGroupSelect.currentTextChanged.connect(self.dataGroupChange) + self.ui.listDataSet.itemClicked.connect(self.datasetSelected) + self.ui.pushButtonFilter.clicked.connect(self.filterDatasets) + self.ui.pushButtonResetFilter.clicked.connect(self.dataGroupChange) + + + @staticmethod + def getFileDataSets(pth='./', title=None, parent=None): # pylint: disable=C0103; # pragma: no cover + """ + Retrieve the filename and datasets selected by the user (via GUI) + + Parameters + ---------- + pth : str + Home directory to start in OR the relative pth to a file + + Returns + ---------- + Tuple (str, str, list[str]) as (path, filename, [dataset(s)]) + + """ + + # pragma: no cover + dialog = HdfLoad(title=title, parent=parent) + + ret_fileopen = True + if pth is None: + pth = './' + else: + pth = _os.path.abspath(pth) + + while True: + ret_fileopen = dialog.fileOpen(pth, title=title) + + ret = None + if ret_fileopen: + ret_dset_select = dialog.exec_() + if ret_dset_select == _QDialog.Rejected: + pth = dialog.path + elif dialog.all_selected is None: + pass + else: + ret = (dialog.path, dialog.filename, dialog.all_selected) + break + else: + break + return ret + + def fileOpen(self, pth='./', title=None): # Qt-related pylint: disable=C0103 + """ Select HDF5 File via QDialog built-in.""" + + if pth is None: + pth = './' + + if title is None: + title_file='Select a file...' + else: + title_file='{}: Select a file...'.format(title) + + if _os.path.isdir(pth): # No file provided, use QFileDialog; # pragma: no cover + filetype_options = 'HDF5 Files (*.h5 *.hdf);;All Files (*.*)' + full_pth_fname, _ = _QFileDialog.getOpenFileName(self, title_file, pth, + filetype_options) + elif _os.path.isfile(pth): # Is a valid file + full_pth_fname = pth + else: + raise FileNotFoundError('Not a valid path. Not a valid file.') + + ret = None + if full_pth_fname: + full_pth_fname = _os.path.abspath(full_pth_fname) # Ensure correct /'s for each OS + self.filename = _os.path.basename(full_pth_fname) + self.path = _os.path.dirname(full_pth_fname) + self.populateGroups() + ret = True + return ret + + def populateGroups(self): # Qt-related pylint: disable=C0103 + """ Populate dropdown box of group ui.comboBoxGroupSelect """ + self.group_dset_dict = get_hierarchy(_os.path.join(self.path, self.filename), + grp_w_dset=HdfLoad.config['only_show_grp_w_dset']) + # Load Group dropdown box + self.ui.comboBoxGroupSelect.clear() + for count in self.group_dset_dict: + self.ui.comboBoxGroupSelect.addItem(count) + return [self.path, self.filename] + + def dataGroupChange(self): # Qt-related pylint: disable=C0103 + """ Action : ComboBox containing Groups with DataSets has changed""" + + #self.dsetlist = QListWidget(self.verticalLayoutWidget) + self.ui.listDataSet.clear() + + if self.ui.comboBoxGroupSelect.currentText() != '': + self.ui.listDataSet.addItems(self.group_dset_dict[self.ui.comboBoxGroupSelect.currentText()]) + #print('Changed') + + def populate_attrs(self, attr_dict=None): + """ Populate attribute and memo boxes for currently selected dataset """ + + self.ui.tableAttributes.setRowCount(0) + self.ui.tableAttributes.setColumnCount(2) + self.ui.tableAttributes.setSortingEnabled(False) + self.ui.textDescription.setText('') + + if attr_dict: + try: + self.ui.textDescription.setText(attr_dict[HdfLoad.config['attr_description']]) + except (KeyError, AttributeError) as error_msg: + print('{}\nNo memo at key {}'.format(error_msg, HdfLoad.config['attr_description'])) + + for num, key in enumerate(attr_dict): + self.ui.tableAttributes.insertRow(self.ui.tableAttributes.rowCount()) + self.ui.tableAttributes.setItem(num, 0, _QTableWidgetItem(key)) + self.ui.tableAttributes.setItem(num, 1, _QTableWidgetItem(str(attr_dict[key]))) + + def datasetSelected(self): # Qt-related pylint: disable=C0103 + """ Action : One or more DataSets were selected from the list """ + + all_selected = self.ui.listDataSet.selectedItems() + n_selected = len(all_selected) + + self.ui.textCurrentDataset.setText('') + self.all_selected = [] + attrs = {} + + if n_selected > 0: + current_selection = all_selected[-1].text() + current_grp = self.ui.comboBoxGroupSelect.currentText() + + selection_str = '{} + ({} others)'.format(current_selection, n_selected - 1) + self.ui.textCurrentDataset.setText(selection_str) + if current_grp == '/': + current_dset_fullpath = '{}{}'.format(current_grp, current_selection) + else: + current_dset_fullpath = '{}/{}'.format(current_grp, current_selection) + # TODO: Figure out a better way to deal with base-group datasets + # Bug when dsets are in base group '/' + current_dset_fullpath = current_dset_fullpath.replace('//','/') + attrs = get_attrs_dset(_os.path.join(self.path, self.filename), + current_dset_fullpath, convert_to_str=True) + self.all_selected = [('{}/{}'.format(current_grp, selection.text())).replace('//','/') + for selection in all_selected] + + # Fill-in attribute table + self.populate_attrs(attr_dict=attrs) + + def filterDatasets(self): # Qt-related pylint: disable=C0103 + """ Filter list of datasets based on include and exclude strings """ + incl_str = self.ui.filterIncludeString.text() + excl_str = self.ui.filterExcludeString.text() + + # From string with comma separation to list-of-strings + incl_list = [q.strip() for q in incl_str.split(',') if q.strip()] + excl_list = [q.strip() for q in excl_str.split(',') if q.strip()] + + dset_list = [self.ui.listDataSet.item(num).text() for num in + range(self.ui.listDataSet.count())] + + if incl_list: # Include list is not empty + dset_list = filterlist(dset_list, incl_list, + keep_filtered_items=True, + exclusive=HdfLoad.config['excl_filtering']) + + if excl_list: # Exclude list is not empty + dset_list = filterlist(dset_list, excl_list, + keep_filtered_items=False, + exclusive=HdfLoad.config['excl_filtering']) + + self.ui.listDataSet.clear() + self.ui.listDataSet.addItems(dset_list) + +if __name__ == '__main__': # pragma: no cover + app = _QApplication(_sys.argv) # pylint: disable=C0103 + result = HdfLoad.getFileDataSets(pth='.', title='Test title') # pylint: disable=C0103 + print('Result: {}'.format(result)) + + _sys.exit() + # pylint: error diff --git a/crikit/io/lazy5/ui/__init__.py b/crikit/io/lazy5/ui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/crikit/io/lazy5/ui/qt5/ui_HDFLoad.ui b/crikit/io/lazy5/ui/qt5/ui_HDFLoad.ui new file mode 100644 index 0000000..6e1ac90 --- /dev/null +++ b/crikit/io/lazy5/ui/qt5/ui_HDFLoad.ui @@ -0,0 +1,279 @@ + + + Dialog + + + + 0 + 0 + 845 + 588 + + + + HDF File Inspector + + + font: 10pt "Arial"; + + + + + + QLayout::SetNoConstraint + + + + + QLayout::SetNoConstraint + + + + + + + Groups Containing Datasets + + + + + + + + + + Datasets + + + + + + + QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + QAbstractItemView::ExtendedSelection + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Include</span> Entires with Substring (separate by ',' [comma])</p></body></html> + + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Exclude</span> Entires with Substring (separate by ',' [comma])</p></body></html> + + + + + + + + + + + + Filter List + + + + + + + Reset List + + + + + + + + + + + + + Current Selection + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + + + + + Atrribute Table + + + + + + + + + + true + + + 2 + + + true + + + 200 + + + false + + + true + + + true + + + false + + + false + + + + Attribute + + + + 10 + + + + + 121 + 121 + 121 + + + + + + 91 + 91 + 91 + + + + + + + Value + + + + 123 + 123 + 123 + + + + + + 91 + 91 + 91 + + + + + + + + + + Dataset Information (Memo) + + + + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + + + + + + + + + 10 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + + diff --git a/crikit/io/lazy5/ui/qt_HdfLoad.py b/crikit/io/lazy5/ui/qt_HdfLoad.py new file mode 100644 index 0000000..3d8be62 --- /dev/null +++ b/crikit/io/lazy5/ui/qt_HdfLoad.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '.\ui_HdfLoad.ui' +# +# Created by: PyQt5 UI code generator 5.8.1 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(845, 588) + Dialog.setStyleSheet("font: 10pt \"Arial\";") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) + self.verticalLayout.setObjectName("verticalLayout") + self.topHL = QtWidgets.QHBoxLayout() + self.topHL.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) + self.topHL.setObjectName("topHL") + self.dataSetVL = QtWidgets.QVBoxLayout() + self.dataSetVL.setObjectName("dataSetVL") + self.label_1 = QtWidgets.QLabel(Dialog) + self.label_1.setObjectName("label_1") + self.dataSetVL.addWidget(self.label_1) + self.comboBoxGroupSelect = QtWidgets.QComboBox(Dialog) + self.comboBoxGroupSelect.setObjectName("comboBoxGroupSelect") + self.dataSetVL.addWidget(self.comboBoxGroupSelect) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.dataSetVL.addWidget(self.label_2) + self.listDataSet = QtWidgets.QListWidget(Dialog) + self.listDataSet.setEditTriggers(QtWidgets.QAbstractItemView.DoubleClicked|QtWidgets.QAbstractItemView.EditKeyPressed|QtWidgets.QAbstractItemView.SelectedClicked) + self.listDataSet.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listDataSet.setObjectName("listDataSet") + self.dataSetVL.addWidget(self.listDataSet) + self.label_3 = QtWidgets.QLabel(Dialog) + self.label_3.setObjectName("label_3") + self.dataSetVL.addWidget(self.label_3) + self.filterIncludeString = QtWidgets.QLineEdit(Dialog) + self.filterIncludeString.setObjectName("filterIncludeString") + self.dataSetVL.addWidget(self.filterIncludeString) + self.label_4 = QtWidgets.QLabel(Dialog) + self.label_4.setObjectName("label_4") + self.dataSetVL.addWidget(self.label_4) + self.filterExcludeString = QtWidgets.QLineEdit(Dialog) + self.filterExcludeString.setObjectName("filterExcludeString") + self.dataSetVL.addWidget(self.filterExcludeString) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.pushButtonFilter = QtWidgets.QPushButton(Dialog) + self.pushButtonFilter.setObjectName("pushButtonFilter") + self.horizontalLayout.addWidget(self.pushButtonFilter) + self.pushButtonResetFilter = QtWidgets.QPushButton(Dialog) + self.pushButtonResetFilter.setObjectName("pushButtonResetFilter") + self.horizontalLayout.addWidget(self.pushButtonResetFilter) + self.dataSetVL.addLayout(self.horizontalLayout) + self.topHL.addLayout(self.dataSetVL) + self.attribVL = QtWidgets.QVBoxLayout() + self.attribVL.setObjectName("attribVL") + self.label_5 = QtWidgets.QLabel(Dialog) + self.label_5.setObjectName("label_5") + self.attribVL.addWidget(self.label_5) + self.textCurrentDataset = QtWidgets.QTextBrowser(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.textCurrentDataset.sizePolicy().hasHeightForWidth()) + self.textCurrentDataset.setSizePolicy(sizePolicy) + self.textCurrentDataset.setMaximumSize(QtCore.QSize(16777215, 100)) + self.textCurrentDataset.setObjectName("textCurrentDataset") + self.attribVL.addWidget(self.textCurrentDataset) + self.label_6 = QtWidgets.QLabel(Dialog) + self.label_6.setObjectName("label_6") + self.attribVL.addWidget(self.label_6) + self.tableAttributes = QtWidgets.QTableWidget(Dialog) + self.tableAttributes.setStyleSheet("") + self.tableAttributes.setColumnCount(2) + self.tableAttributes.setObjectName("tableAttributes") + self.tableAttributes.setRowCount(0) + item = QtWidgets.QTableWidgetItem() + font = QtGui.QFont() + font.setPointSize(10) + item.setFont(font) + item.setBackground(QtGui.QColor(121, 121, 121)) + brush = QtGui.QBrush(QtGui.QColor(91, 91, 91)) + brush.setStyle(QtCore.Qt.SolidPattern) + item.setForeground(brush) + self.tableAttributes.setHorizontalHeaderItem(0, item) + item = QtWidgets.QTableWidgetItem() + item.setBackground(QtGui.QColor(123, 123, 123)) + brush = QtGui.QBrush(QtGui.QColor(91, 91, 91)) + brush.setStyle(QtCore.Qt.SolidPattern) + item.setForeground(brush) + self.tableAttributes.setHorizontalHeaderItem(1, item) + self.tableAttributes.horizontalHeader().setCascadingSectionResizes(True) + self.tableAttributes.horizontalHeader().setDefaultSectionSize(200) + self.tableAttributes.horizontalHeader().setHighlightSections(False) + self.tableAttributes.horizontalHeader().setSortIndicatorShown(True) + self.tableAttributes.horizontalHeader().setStretchLastSection(True) + self.tableAttributes.verticalHeader().setVisible(False) + self.tableAttributes.verticalHeader().setHighlightSections(False) + self.attribVL.addWidget(self.tableAttributes) + self.label_7 = QtWidgets.QLabel(Dialog) + self.label_7.setObjectName("label_7") + self.attribVL.addWidget(self.label_7) + self.textDescription = QtWidgets.QTextBrowser(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.textDescription.sizePolicy().hasHeightForWidth()) + self.textDescription.setSizePolicy(sizePolicy) + self.textDescription.setMaximumSize(QtCore.QSize(16777215, 100)) + self.textDescription.setObjectName("textDescription") + self.attribVL.addWidget(self.textDescription) + self.topHL.addLayout(self.attribVL) + self.verticalLayout.addLayout(self.topHL) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setContentsMargins(-1, 10, -1, -1) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.pushButtonOk = QtWidgets.QPushButton(Dialog) + self.pushButtonOk.setObjectName("pushButtonOk") + self.horizontalLayout_2.addWidget(self.pushButtonOk) + self.pushButtonCancel = QtWidgets.QPushButton(Dialog) + self.pushButtonCancel.setObjectName("pushButtonCancel") + self.horizontalLayout_2.addWidget(self.pushButtonCancel) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.verticalLayout_2.addLayout(self.verticalLayout) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "HDF File Inspector")) + self.label_1.setText(_translate("Dialog", "Groups Containing Datasets")) + self.label_2.setText(_translate("Dialog", "Datasets")) + self.label_3.setText(_translate("Dialog", "

Include Entires with Substring (separate by \',\' [comma])

")) + self.label_4.setText(_translate("Dialog", "

Exclude Entires with Substring (separate by \',\' [comma])

")) + self.pushButtonFilter.setText(_translate("Dialog", "Filter List")) + self.pushButtonResetFilter.setText(_translate("Dialog", "Reset List")) + self.label_5.setText(_translate("Dialog", "Current Selection")) + self.label_6.setText(_translate("Dialog", "Atrribute Table")) + self.tableAttributes.setSortingEnabled(True) + item = self.tableAttributes.horizontalHeaderItem(0) + item.setText(_translate("Dialog", "Attribute")) + item = self.tableAttributes.horizontalHeaderItem(1) + item.setText(_translate("Dialog", "Value")) + self.label_7.setText(_translate("Dialog", "Dataset Information (Memo)")) + self.pushButtonOk.setText(_translate("Dialog", "OK")) + self.pushButtonCancel.setText(_translate("Dialog", "Cancel")) + diff --git a/crikit/io/lazy5/utils.py b/crikit/io/lazy5/utils.py new file mode 100644 index 0000000..499defa --- /dev/null +++ b/crikit/io/lazy5/utils.py @@ -0,0 +1,93 @@ +""" Utility functions """ +import os as _os + +import h5py as _h5py +import numpy as _np + +from .config import DefaultConfig +_h5py.get_config().complex_names = DefaultConfig().complex_names + +__all__ = ['FidOrFile', 'hdf_is_open', 'fullpath'] + +class FidOrFile: + """ + Class for opening an HDF5 file and returning a file ID (fid) or if passed + and already open fid, passing it along (pass-thru). Primarily for enabling + functions and methods to operate on open and closed files. + + Parameters + ---------- + file : str or h5py.File + Filename or File-object for open HDF5 file + + mode : str + If opening a file, open with mode. Available: r,r+,w,w-,x,a + + Attributes + ---------- + is_fid : bool + Was the input file actually an fid. + + fid : h5py.File object + File ID + """ + def __init__(self, file=None, mode='r'): + self.is_fid = None + self.fid = None + if file is not None: + self.return_fid_from_file(file, mode=mode) + + def return_fid_from_file(self, file, mode='r'): + """ + Return an open fid (h5py.File). If provided a string, open file, else + pass-thru given fid. + + Parameters + ---------- + file : str or h5py.File + Filename or File-object for open HDF5 file + + mode : str + If opening a file, open with mode. Available: r,r+,w,w-,x,a + + Returns + ------- + fid : h5py.File object + File ID + + """ + self.is_fid = isinstance(file, _h5py.File) + if not self.is_fid: + self.fid = _h5py.File(file, mode=mode) + else: + self.fid = file + return self.fid + + def close_if_file_not_fid(self): + """ Close the file if originally a filename (not a fid) was passed """ + if not self.is_fid: + return self.fid.close() + else: + return None + +def hdf_is_open(fid): + """ Is an HDF file open via fid """ + # ! New h5py v 2.9.*: id instead of fid + try: + status = fid.id.valid + except AttributeError: + status = fid.fid.valid + + if status == 0: + return False + elif status == 1: + return True + else: + return None + +def fullpath(filename, pth=None): + """ Return a full path by joining a pth and filename """ + if not pth: + return filename + else: + return _os.path.join(pth, filename) \ No newline at end of file diff --git a/crikit/io/macros.py b/crikit/io/macros.py index 8c5eb0b..69e1b77 100644 --- a/crikit/io/macros.py +++ b/crikit/io/macros.py @@ -3,19 +3,28 @@ @author: chc """ -import os as _os -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.meta_configs import (special_nist_bcars2 as _snb, special_nist_bcars1_sample_scan as _snb1ss) from crikit.io.meta_process import meta_process as _meta_process -from crikit.io.hdf5 import hdf_import_data as _hdf_import_data +from crikit.io.hdf5 import (hdf_import_data as _hdf_import_data, hdf_import_data_macroraster as _hdf_import_data_macroraster) from crikit.io.csv_nist import csv_nist_import_data as _csv_nist_import_data __all__ = ['import_hdf_nist_special', 'import_csv_nist_special1'] +def hdf_nist_special_macroraster(pth, filename, dset_list, output_cls_instance): + print('\n') + import_success = _hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance) + if import_success is False: + raise ValueError('hdf_import_data_macroraster failed') + return False + _meta_process(_snb(), output_cls_instance) + return True + + def import_hdf_nist_special(pth, filename, dset, output_cls_instance): """ Import data from HDF File as specified by NIST-specific settings @@ -25,7 +34,7 @@ def import_hdf_nist_special(pth, filename, dset, output_cls_instance): Success : bool Whether import was successful """ - + print('\n') import_success = _hdf_import_data(pth, filename, dset, output_cls_instance) if import_success is False: @@ -34,6 +43,7 @@ def import_hdf_nist_special(pth, filename, dset, output_cls_instance): _meta_process(_snb(), output_cls_instance) return True + def import_hdf_nist_special_ooc(pth, filename, dset, output_cls_instance): """ Import data from HDF File (OUT-OF-CORE) as specified by NIST-specific settings @@ -43,7 +53,7 @@ def import_hdf_nist_special_ooc(pth, filename, dset, output_cls_instance): Success : bool Whether import was successful """ - + print('\n') try: @@ -51,12 +61,13 @@ def import_hdf_nist_special_ooc(pth, filename, dset, output_cls_instance): output_cls_instance._data = fid[dset] output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset) _meta_process(_snb(), output_cls_instance) - except: + except Exception: raise ValueError('hdf_import_data failed') return False else: - return fid - + return fid + + def import_csv_nist_special1(pth, filename_header, filename_data, output_cls_instance): """ @@ -74,31 +85,31 @@ def import_csv_nist_special1(pth, filename_header, filename_data, if import_success is None or import_success is False: raise ValueError('csv_import_data returned None') _meta_process(_snb1ss(), output_cls_instance) - except: + except Exception: print('Something failed in import_csv_nist_special') return False else: return True + if __name__ == '__main__': # pragma: no cover - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi pth = '../' filename = 'mP2_w_small.h5' img = _Hsi() - import_hdf_nist_special(pth, filename,'/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small',img) + import_hdf_nist_special(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img) print('Shape of img: {}'.format(img.shape)) print('Shape of img.mean(): {}'.format(img.mean().shape)) print(img.y_rep.data) - - # from crikit.data.spectrum import Spectrum as _Spectrum - + + # from crikit.data.spectra import Spectrum as _Spectrum + # sp = _Spectrum() # pth = '../../../Young_150617/' # filename_header = 'SH-03.h' # filename_data = 'base061715_152213_60ms.txt' - + # import_csv_nist_special1(pth, filename_header, filename_data, # output_cls_instance=sp) - \ No newline at end of file diff --git a/crikit/io/meta_configs.py b/crikit/io/meta_configs.py index e64982a..6af213f 100644 --- a/crikit/io/meta_configs.py +++ b/crikit/io/meta_configs.py @@ -9,50 +9,47 @@ @author: chc """ + def special_nist_bcars2(): """ Return import attributes particular to the "BCARS 2" system at NIST """ rosetta = {} - rosetta['XPixelSize'] = ['RasterScanParams.FastAxisStepSize', - 'Raster.Fast.StepSize','!',1] - rosetta['XStart'] = ['RasterScanParams.FastAxisStart', 'Raster.Fast.Start'] - rosetta['XStop'] = ['RasterScanParams.FastAxisStop', 'Raster.Fast.Stop'] - rosetta['XLength'] = ['RasterScanParams.FastAxisSteps', 'Raster.Fast.Steps'] - rosetta['XLabel'] = ['RasterScanParams.FastAxis','Raster.Fast.Axis','!','X'] - rosetta['XUnits'] = ['RasterScanParams.FastAxisUnits','!','$\\mu$m'] - - rosetta['YPixelSize'] = ['RasterScanParams.SlowAxisStepSize', - 'Raster.Slow.StepSize','!',1] - rosetta['YStart'] = ['RasterScanParams.SlowAxisStart', 'Raster.Slow.Start'] - rosetta['YStop'] = ['RasterScanParams.SlowAxisStop', 'Raster.Slow.Stop'] - rosetta['YLength'] = ['RasterScanParams.SlowAxisSteps', 'Raster.Slow.Steps'] - rosetta['YLabel'] = ['RasterScanParams.SlowAxis','Raster.Slow.Axis','!','Y'] - rosetta['YUnits'] = ['RasterScanParams.SlowAxisUnits','!','$\\mu$m'] - - rosetta['ZPosition'] = ['RasterScanParams.FixedAxisPosition', - 'Raster.Stack.Position','!',0] - rosetta['ZLabel'] = ['RasterScanParams.FixedAxis', 'Raster.Stack.Axis','!','Z'] + rosetta['XPixelSize'] = ['Macro.Raster.Fast.StepSize', 'RasterScanParams.FastAxisStepSize', + 'Raster.Fast.StepSize', '!', 1] + rosetta['XStart'] = ['Macro.Raster.Fast.Start', 'RasterScanParams.FastAxisStart', 'Raster.Fast.Start'] + rosetta['XStop'] = ['Macro.Raster.Fast.Stop', 'RasterScanParams.FastAxisStop', 'Raster.Fast.Stop'] + rosetta['XLength'] = ['Macro.Raster.Fast.Steps', 'RasterScanParams.FastAxisSteps', 'Raster.Fast.Steps'] + rosetta['XLabel'] = ['Macro.Raster.Fast.Axis', 'RasterScanParams.FastAxis', 'Raster.Fast.Axis', '!', 'X'] + rosetta['XUnits'] = ['MicroStage.raster.fast.units', 'RasterScanParams.FastAxisUnits', '!', '$\\mu$m'] + + rosetta['YPixelSize'] = ['Macro.Raster.Slow.StepSize', 'RasterScanParams.SlowAxisStepSize', 'Raster.Slow.StepSize', '!', 1] + rosetta['YStart'] = ['Macro.Raster.Slow.Start', 'RasterScanParams.SlowAxisStart', 'Raster.Slow.Start'] + rosetta['YStop'] = ['Macro.Raster.Slow.Stop', 'RasterScanParams.SlowAxisStop', 'Raster.Slow.Stop'] + rosetta['YLength'] = ['Macro.Raster.Slow.Steps', 'RasterScanParams.SlowAxisSteps', 'Raster.Slow.Steps'] + rosetta['YLabel'] = ['Macro.Raster.Slow.Axis', 'RasterScanParams.SlowAxis', 'Raster.Slow.Axis', '!', 'Y'] + rosetta['YUnits'] = ['MicroStage.raster.slow.units', 'RasterScanParams.SlowAxisUnits', '!', '$\\mu$m'] + + # TODO: Set an actual Z fixed position for Macro raster scan + rosetta['ZPosition'] = ['Macro.Raster.Fixed.Start', 'Raster.Fixed.Position','RasterScanParams.FixedAxisPosition', + 'Raster.Stack.Position', '!', 0] + rosetta['ZLabel'] = ['Macro.Raster.Fixed.Axis', 'RasterScanParams.FixedAxis', 'Raster.Fixed.Axis', 'Raster.Stack.Axis', '!', 'Z'] # Color Calibration - rosetta['ColorCenterWL'] = ['Spectro.CenterWavelength', - 'Spectro.CurrentWavelength', 'Calib.ctr_wl', - '!', 729.994] + rosetta['ColorCenterWL'] = ['Spectrometer.calib.ctr_wl', 'Spectro.CenterWavelength', 'Spectro.CurrentWavelength', 'Calib.ctr_wl', '!', 729.994] rosetta['ColorUnits'] = ['Calib.units', '!', 'nm'] - rosetta['ColorChannels'] = ['Calib.n_pix', 'Spectro.SpectralPixels','!', 1600] - rosetta['ColorCalibWL'] = ['Calib.ctr_wl0', 'Spectro.CalibWavelength', '!', 729.994] - rosetta['ColorPolyVals'] = ['Calib.a_vec', 'Spectro.Avec', '!', [-0.167740721307557, - 863.8736708961577]] + rosetta['ColorChannels'] = ['Spectrometer.calib.n_pix', 'Calib.n_pix', 'Spectro.SpectralPixels', '!', 1600] + rosetta['ColorCalibWL'] = ['Spectrometer.calib.ctr_wl0', 'Calib.ctr_wl0', 'Spectro.CalibWavelength', '!', 729.994] + rosetta['ColorPolyVals'] = ['Spectrometer.calib.a_vec', 'Calib.a_vec', 'Spectro.Avec', '!', [-0.167740721307557, 863.8736708961577]] - rosetta['ColorProbe'] = ['Calib.probe', 'Spectro.ProbeWavelength', '!', 771.461] + rosetta['ColorProbe'] = ['Spectrometer.calib.probe', 'Calib.probe', 'Spectro.ProbeWavelength', '!', 771.461] rosetta['ColorWnMode'] = ['!', True] # Color Calibration Original rosetta['OrigColorCenterWL'] = ['CalibOrig.ctr_wl', 'Spectro.CenterWavelength', - 'Spectro.CurrentWavelength', - ] + 'Spectro.CurrentWavelength'] rosetta['OrigColorUnits'] = ['CalibOrig.units'] rosetta['OrigColorChannels'] = ['CalibOrig.n_pix'] rosetta['OrigColorCalibWL'] = ['CalibOrig.ctr_wl'] @@ -64,6 +61,7 @@ def special_nist_bcars2(): return rosetta + def special_nist_bcars1_sample_scan(): """ Return import attributes particular to the "BCARS 1" system at NIST @@ -88,7 +86,7 @@ def special_nist_bcars1_sample_scan(): rosetta['ZLabel'] = 'RasterScanParams.FixedAxis' rosetta['ColorCenterWL'] = ['Frequency Calibration.CenterWavelength', '!', 696.831] - rosetta['ColorUnits'] = ['!','nm'] + rosetta['ColorUnits'] = ['!', 'nm'] rosetta['ColorChannels'] = ['Frequency Calibration.freq index length', '!', 512] rosetta['ColorCalibWL'] = ['Frequency Calibration.CenterWavelength', '!', 696.831] @@ -99,8 +97,8 @@ def special_nist_bcars1_sample_scan(): rosetta['ColorPolyVals'] = ['Frequency Calibration.Polyvals', '!', [-0.50418919, 825.651318]] - rosetta['ColorProbe'] = ['Frequency Calibration.probe(nm)','!', 830.0] + rosetta['ColorProbe'] = ['Frequency Calibration.probe(nm)', '!', 830.0] rosetta['ColorWnMode'] = ['!', True] - # rosetta['ColorCalibWN'] = ['Processing.WNCalib','Processing.WNCalibOrig'] + # rosetta['ColorCalibWN'] = ['Processing.WNCalib', 'Processing.WNCalibOrig'] - return rosetta \ No newline at end of file + return rosetta diff --git a/crikit/io/meta_process.py b/crikit/io/meta_process.py index 8d55af3..a4db4a0 100644 --- a/crikit/io/meta_process.py +++ b/crikit/io/meta_process.py @@ -7,9 +7,9 @@ from crikit.data.frequency import (calib_pix_wn as _calib_pix_wn, calib_pix_wl as _calib_pix_wl) -from crikit.data.spectrum import Spectrum as _Spectrum +from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra -from crikit.data.hsi import Hsi as _Hsi +from crikit.data.spectra import Hsi as _Hsi import numpy as _np @@ -38,7 +38,7 @@ def rosetta_query(key, rosetta, output_cls_instance): break else: pass - except: + except Exception: temp_val = None temp_key = None @@ -50,7 +50,7 @@ def rosetta_query(key, rosetta, output_cls_instance): elif isinstance(rosetta[key],str): try: temp = output_cls_instance._meta[rosetta[key]] - except: + except Exception: return None else: return (temp, rosetta[key]) @@ -72,7 +72,7 @@ def meta_process(rosetta, output_cls_instance): calib_dict['a_vec'] = temp[0] del temp - temp = rosetta_query('ColorChannels',rosetta, output_cls_instance) + temp = rosetta_query('ColorChannels', rosetta, output_cls_instance) print('Color/Frequency-Channels: {} from {}'.format(temp[0], temp[1])) if temp[0] != output_cls_instance.shape[-1]: print('WARNING: Number of color channels assigned in meta data ({}) disagrees with datacube size ({})'.format(temp[0], output_cls_instance.shape[-1])) @@ -136,7 +136,7 @@ def meta_process(rosetta, output_cls_instance): calib_orig_dict['probe'] = rosetta_query('OrigColorProbe',rosetta, output_cls_instance)[0] calib_orig_dict['units'] = rosetta_query('OrigColorUnits',rosetta, output_cls_instance)[0] - except: + except Exception: print('Original calibration not found.') else: print('Original calibration found.') @@ -256,7 +256,7 @@ def meta_process(rosetta, output_cls_instance): output_cls_instance.reps.data = _np.arange(output_cls_instance.data.shape[0]) # print(output_cls_instance.reps.data.shape) output_cls_instance.reps.update_calib_from_data() - except: + except Exception: print('Something failed in meta_process: Spectra rep-calib') elif type(output_cls_instance) == _Spectrum: diff --git a/crikit/io/tests/test_hdf5.py b/crikit/io/tests/test_hdf5.py index f0c7acd..5600d1c 100644 --- a/crikit/io/tests/test_hdf5.py +++ b/crikit/io/tests/test_hdf5.py @@ -4,12 +4,12 @@ import pytest import h5py -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi @pytest.fixture(scope="module") def hdf_dataset(): diff --git a/crikit/measurement/peakfind.py b/crikit/measurement/peakfind.py index 0c4e1cd..c8d448a 100644 --- a/crikit/measurement/peakfind.py +++ b/crikit/measurement/peakfind.py @@ -129,7 +129,7 @@ def cwt_diff(signal, wv_width, order=1, method='auto'): try: deriv = _convolve(deriv, PeakFinder.haar(wv_width), mode='same', method=method) - except: + except Exception: print('peakfind.py | cwt_diff: Likely using an old version of SciPy (no convolve method parameter)') deriv = _convolve(deriv, PeakFinder.haar(wv_width), mode='same') return deriv @@ -185,7 +185,7 @@ def calculate(self, y, x=None, recalc_cutoff=True, method='auto'): amps_retr = [] for l, s in zip(omegas_retr_locs, sigma_retr_locs): - dl = _np.abs(_np.ceil((l - s)/10)).astype(_np.integer) + dl = _np.abs(_np.ceil((l - s)/10)).astype(_np.int32) amps_retr.append(_np.median(y[l-dl:l+dl+1])) amps_retr = _np.array(amps_retr) diff --git a/crikit/measurement/tests/test_measurement.py b/crikit/measurement/tests/test_measurement.py index b899a9a..34976be 100644 --- a/crikit/measurement/tests/test_measurement.py +++ b/crikit/measurement/tests/test_measurement.py @@ -3,7 +3,7 @@ import pytest -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.measurement.peakamps import (MeasurePeak, MeasurePeakAdd, MeasurePeakMinus, MeasurePeakMultiply, MeasurePeakDivide, MeasurePeakMax, MeasurePeakMin, diff --git a/crikit/measurement/tests/test_measurements_complex.py b/crikit/measurement/tests/test_measurements_complex.py index 2974dbe..d2f74cc 100644 --- a/crikit/measurement/tests/test_measurements_complex.py +++ b/crikit/measurement/tests/test_measurements_complex.py @@ -3,7 +3,7 @@ import pytest -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.measurement.peakamps import (MeasurePeak, MeasurePeakAdd, MeasurePeakMinus, MeasurePeakMultiply, MeasurePeakDivide, MeasurePeakMax, MeasurePeakMin, diff --git a/crikit/preprocess/algorithms/abstract_als.py b/crikit/preprocess/algorithms/abstract_als.py index 96edfd2..15fe796 100644 --- a/crikit/preprocess/algorithms/abstract_als.py +++ b/crikit/preprocess/algorithms/abstract_als.py @@ -63,7 +63,7 @@ def calculate(self, signal): # Dummy indep variable x = _np.arange(self.rng.size) x_sub = _np.linspace(x[0], x[-1], _np.round(x.size / - self.redux).astype(_np.integer)) + self.redux).astype(_np.int32)) self.redux_sig_shape = list(self.full_sig_shape) self.redux_sig_shape[-1] = x_sub.size self.redux_sig_spectral_size = self.redux_sig_shape[-1] @@ -82,7 +82,7 @@ def calculate(self, signal): # Spline interpolation/super-sampling for coords in _np.ndindex(output_sampled.shape[0:-1]): spl2 = _USpline(x_sub,output_sampled[coords],s=0) - output[[*coords, self.rng]] = spl2(x) + output[(*coords, self.rng)] = spl2(x) tmr -= _timeit.default_timer() self.t = -tmr @@ -99,5 +99,5 @@ def fix_rng(self): return self._fix_rng else: redux_fix_rng = self._fix_rng / self.redux - redux_fix_rng = _np.unique(redux_fix_rng).astype(_np.integer) + redux_fix_rng = _np.unique(redux_fix_rng).astype(_np.int32) return redux_fix_rng diff --git a/crikit/preprocess/algorithms/als.py b/crikit/preprocess/algorithms/als.py index abbe12c..fda37bd 100644 --- a/crikit/preprocess/algorithms/als.py +++ b/crikit/preprocess/algorithms/als.py @@ -88,7 +88,7 @@ def asym_param(self): elif self.redux > 1: x = _np.arange(self.rng.size) x_sub = _np.linspace(x[0], x[-1], _np.round(x.size / - self.redux).astype(_np.integer)) + self.redux).astype(_np.int32)) spl = _USpline(x,self._asym_param[self.rng],s=0) return spl(x_sub) @@ -159,7 +159,7 @@ def _calc(self, signal): # Solve A * baseline_current = w_sp * Signal _cholmod.linsolve(minimazation_matrix,x,uplo='U') - except: + except Exception: print('Failure in Cholesky factorization') break else: diff --git a/crikit/preprocess/crop.py b/crikit/preprocess/crop.py index 62dc856..2bd07a2 100644 --- a/crikit/preprocess/crop.py +++ b/crikit/preprocess/crop.py @@ -32,7 +32,7 @@ def _calc(self, data, ret_obj): self.zero_col = _np.nonzero(row_sums)[0][self.fol] ret_obj[:, self.zero_col, :] *= 0 - except: + except Exception: return False else: return True @@ -74,7 +74,7 @@ def _calc(self, data, ret_obj): self.zero_row = _np.nonzero(col_sums)[0][self.fol] ret_obj[self.zero_row, :, :] *= 0 - except: + except Exception: return False else: return True diff --git a/crikit/preprocess/denoise.py b/crikit/preprocess/denoise.py index 4a28ba9..a631d57 100644 --- a/crikit/preprocess/denoise.py +++ b/crikit/preprocess/denoise.py @@ -75,7 +75,7 @@ def _calc(self, data, ret_obj): else: self._U, self._s, self._Vh = _svd(data[..., self.rng], full_matrices=False) - except: + except Exception: return False else: return True @@ -180,7 +180,7 @@ def _calc(self, U, s, Vh, ret_obj): # shp) ret_obj[..., self.rng] += _np.reshape(_np.dot(U[:, self.svs], _np.dot(_np.diag(s[self.svs]),Vh[self.svs, :])), shp) - except: + except Exception: return False else: return True diff --git a/crikit/preprocess/standardize.py b/crikit/preprocess/standardize.py index d3193e1..e099279 100644 --- a/crikit/preprocess/standardize.py +++ b/crikit/preprocess/standardize.py @@ -156,7 +156,7 @@ def _calc(self, data, ret_obj): try: ret_obj *= 0 ret_obj[..., self.rng] = out - except: + except Exception: return False else: return True @@ -283,7 +283,7 @@ def _calc(self, data, ret_obj): try: ret_obj *= 0 ret_obj[..., self.rng] = out - except: + except Exception: return False else: return True @@ -330,7 +330,7 @@ def calculate(self, data): if __name__ == '__main__': # pragma: no cover - from crikit.data.spectrum import Spectrum as _Spectrum + from crikit.data.spectra import Spectrum as _Spectrum stddev = 20 gain = 1 diff --git a/crikit/preprocess/subtract_baseline.py b/crikit/preprocess/subtract_baseline.py index fa99f33..c749e8d 100644 --- a/crikit/preprocess/subtract_baseline.py +++ b/crikit/preprocess/subtract_baseline.py @@ -83,7 +83,7 @@ def _calc(self, data, ret_obj, **kwargs): # ret_obj[idx] -= self._inst_als.calculate(data[idx].real) # else: ret_obj[idx] -= self._inst_als.calculate(data[idx].real) - except: + except Exception: return False else: # print(self._inst_als.__dict__) diff --git a/crikit/preprocess/subtract_dark.py b/crikit/preprocess/subtract_dark.py index 6db990c..25cfeff 100644 --- a/crikit/preprocess/subtract_dark.py +++ b/crikit/preprocess/subtract_dark.py @@ -7,9 +7,9 @@ import numpy as _np import copy as _copy -from crikit.data.spectrum import Spectrum as _Spectrum +from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra -from crikit.data.hsi import Hsi as _Hsi +from crikit.data.spectra import Hsi as _Hsi from crikit.utils.general import (expand_1d_to_ndim as _expand_1d_to_ndim, mean_nd_to_1d as _mean_nd_to_1d) diff --git a/crikit/preprocess/subtract_mean.py b/crikit/preprocess/subtract_mean.py index 762d85a..86fa73b 100644 --- a/crikit/preprocess/subtract_mean.py +++ b/crikit/preprocess/subtract_mean.py @@ -25,7 +25,7 @@ def _calc(self, data, ret_obj): try: ret_obj -= meaner[..., None] - except: + except Exception: return False else: return True @@ -75,9 +75,9 @@ def calculate(self, data): if __name__ == '__main__': # pragma: no cover - from crikit.data.spectrum import Spectrum as _Spectrum + from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi diff --git a/crikit/preprocess/tests/test_subtract_dark.py b/crikit/preprocess/tests/test_subtract_dark.py index a560d74..069c188 100644 --- a/crikit/preprocess/tests/test_subtract_dark.py +++ b/crikit/preprocess/tests/test_subtract_dark.py @@ -234,8 +234,8 @@ def test_sub_hsi_int_from_hsi_float(make_datasets): """ Dark is HSI. Data is HSI. """ spectrum, spectra, hsi, shape = make_datasets - data = (1*hsi).astype(np.float) - dark = (1*hsi).astype(np.int) + data = (1*hsi).astype(float) + dark = (1*hsi).astype(int) subdark = SubtractDark(dark) @@ -250,7 +250,7 @@ def test_sub_hsi_int_from_hsi_float(make_datasets): np.testing.assert_array_almost_equal(out, data - dark.mean(axis=(0,1))[None,None,:]) # Transform - dark = (1*hsi).astype(np.int) + dark = (1*hsi).astype(int) subdark = SubtractDark(dark) success = subdark.transform(data) np.testing.assert_array_almost_equal(data, out) @@ -268,59 +268,59 @@ def test_transform_incompatible_dtypes(make_datasets): spectrum, spectra, hsi, shape = make_datasets # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) subdark.transform(data) diff --git a/crikit/ui/classes_ui.py b/crikit/ui/classes_ui.py index b8c2bac..d25f520 100644 --- a/crikit/ui/classes_ui.py +++ b/crikit/ui/classes_ui.py @@ -80,7 +80,7 @@ def std(self): try: temp = self.grayscaleimage.std() return temp - except: + except Exception: return None @property @@ -88,7 +88,7 @@ def mean(self): try: temp = self.grayscaleimage.mean() return temp - except: + except Exception: return None @property @@ -119,7 +119,7 @@ def grayscaleimage(self, value): else: pass - except: + except Exception: print('Set grayscaleimage error') @grayscaleimage.deleter diff --git a/crikit/ui/dialog_AbstractFactorization.py b/crikit/ui/dialog_AbstractFactorization.py index 9d070bf..f85e4e6 100644 --- a/crikit/ui/dialog_AbstractFactorization.py +++ b/crikit/ui/dialog_AbstractFactorization.py @@ -144,7 +144,7 @@ def applyCheckBoxes(self): else: try: self.selected_factors.remove(self._first_factor_visible+count) - except: + except Exception: pass #print('Self.S: {}'.format(self.svddata.S[0:3])) diff --git a/crikit/ui/dialog_SVD.py b/crikit/ui/dialog_SVD.py index a0b1c25..43934b6 100644 --- a/crikit/ui/dialog_SVD.py +++ b/crikit/ui/dialog_SVD.py @@ -75,7 +75,7 @@ def max_factors(self): """ try: return self.s.size - except: + except Exception: return None def combiner(self, selections=None): diff --git a/crikit/ui/dialog_kkOptions.py b/crikit/ui/dialog_kkOptions.py index 4b249bb..65067a0 100644 --- a/crikit/ui/dialog_kkOptions.py +++ b/crikit/ui/dialog_kkOptions.py @@ -142,7 +142,7 @@ def dialogKKOptions(parent=None, data=None, conjugate=False): # winDark = DialogDarkOptions.dialogDarkOptions(darkloaded=True) - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi temp = _Hsi() diff --git a/crikit/ui/dialog_ploteffect.py b/crikit/ui/dialog_ploteffect.py index 0f6dc7f..8c05663 100644 --- a/crikit/ui/dialog_ploteffect.py +++ b/crikit/ui/dialog_ploteffect.py @@ -141,7 +141,7 @@ def make_plots(self, canvas, data, lw=1, ls='-'): self.plot_labels() try: canvas.fig.tight_layout() - except: + except Exception: print('Tight layout failed (dialog_ploteffect') diff --git a/crikit/ui/main_Mosaic.py b/crikit/ui/main_Mosaic.py index 90de4d4..434bb64 100644 --- a/crikit/ui/main_Mosaic.py +++ b/crikit/ui/main_Mosaic.py @@ -30,9 +30,9 @@ from sciplot.ui.widget_mpl import MplCanvas as _MplCanvas -import lazy5 -from lazy5.utils import FidOrFile, fullpath -from lazy5.ui.QtHdfLoad import HdfLoad +import crikit.io.lazy5 as lazy5 +from crikit.io.lazy5.utils import FidOrFile, fullpath +from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad class DnDReorderListWidget(_QListWidget): diff --git a/crikit/ui/qt5/make_uis.bat b/crikit/ui/qt5/make_uis.bat new file mode 100644 index 0000000..24db8e5 --- /dev/null +++ b/crikit/ui/qt5/make_uis.bat @@ -0,0 +1 @@ +call pyuic5.bat ./crikit/ui/qt5/ui_CRIkit.ui -o ./crikit/ui/qt_CRIkit.py --from-imports \ No newline at end of file diff --git a/crikit/ui/qt5/ui_CRIkit.ui b/crikit/ui/qt5/ui_CRIkit.ui index b64986e..6a4567d 100644 --- a/crikit/ui/qt5/ui_CRIkit.ui +++ b/crikit/ui/qt5/ui_CRIkit.ui @@ -396,7 +396,7 @@ This will be saved to the processed file. 0 0 1200 - 19 + 20 @@ -405,6 +405,7 @@ This will be saved to the processed file. + @@ -1391,6 +1392,15 @@ This will be saved to the processed file. Auto-Crop NRB Spectra + + + + :/icons/open-iconic-master/png/envelope-open-4x.png:/icons/open-iconic-master/png/envelope-open-4x.png + + + Open HDF Macro Raster (NIST)... + + diff --git a/crikit/ui/qt_CRIkit.py b/crikit/ui/qt_CRIkit.py index 4175e9a..5fb1041 100644 --- a/crikit/ui/qt_CRIkit.py +++ b/crikit/ui/qt_CRIkit.py @@ -1,15 +1,13 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '.\ui_CRIkit.ui' +# Form implementation generated from reading ui file './crikit/ui/qt5/ui_CRIkit.ui' # -# Created by: PyQt5 UI code generator 5.13.0 +# Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! - from PyQt5 import QtCore, QtGui, QtWidgets - class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") @@ -187,7 +185,7 @@ def setupUi(self, MainWindow): self.gridLayout_7.addLayout(self.verticalLayout_3, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1200, 19)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1200, 20)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -542,8 +540,12 @@ def setupUi(self, MainWindow): self.actionAutoCropDarkSpectra.setObjectName("actionAutoCropDarkSpectra") self.actionAutoCropNRBSpectra = QtWidgets.QAction(MainWindow) self.actionAutoCropNRBSpectra.setObjectName("actionAutoCropNRBSpectra") + self.actionOpen_HDF_Macro_Raster_NIST = QtWidgets.QAction(MainWindow) + self.actionOpen_HDF_Macro_Raster_NIST.setIcon(icon) + self.actionOpen_HDF_Macro_Raster_NIST.setObjectName("actionOpen_HDF_Macro_Raster_NIST") self.menuFile.addAction(self.actionOpenHDFNIST) self.menuFile.addAction(self.actionOpenDLMNIST) + self.menuFile.addAction(self.actionOpen_HDF_Macro_Raster_NIST) self.menuFile.addAction(self.actionSave) self.menuFile.addSeparator() self.menuFile.addAction(self.actionOpenHDFNISTOOC) @@ -770,4 +772,6 @@ def retranslateUi(self, MainWindow): self.actionCropNRBSpectra.setText(_translate("MainWindow", "Crop NRB Spectra")) self.actionAutoCropDarkSpectra.setText(_translate("MainWindow", "Auto-Crop Dark Spectra")) self.actionAutoCropNRBSpectra.setText(_translate("MainWindow", "Auto-Crop NRB Spectra")) + self.actionOpen_HDF_Macro_Raster_NIST.setText(_translate("MainWindow", "Open HDF Macro Raster (NIST)...")) + from . import icons_all_rc diff --git a/crikit/ui/utils/check_requirements.py b/crikit/ui/utils/check_requirements.py index d5b5f7e..8322be2 100644 --- a/crikit/ui/utils/check_requirements.py +++ b/crikit/ui/utils/check_requirements.py @@ -16,8 +16,7 @@ def check_requirements(): 'matplotlib':None, 'scipy':None, 'sciplot': '0.2.2', - 'cvxopt':None, - 'lazy5':'0.2.2'} + 'cvxopt':None} output = [] for r in requirement_dict: diff --git a/crikit/ui/widget_DeTrending.py b/crikit/ui/widget_DeTrending.py index 662ac3a..355d312 100644 --- a/crikit/ui/widget_DeTrending.py +++ b/crikit/ui/widget_DeTrending.py @@ -23,7 +23,7 @@ # Try to add arPLS to detrend options try: from crikit.ui.widget_ArPLS import widgetArPLS -except: +except Exception: pass else: _widget_list_names.append('ArPLS') @@ -72,13 +72,13 @@ def __init__(self, parent = None): # to this container's version of the change-signal try: wdgt.changed.connect(self.widgetOptionsChanged) - except: + except Exception: pass else: wdgt.setVisible(False) try: wdgt.changed.disconnect(self.widgetOptionsChanged) - except: + except Exception: pass # SIGNALS & SLOTS @@ -113,7 +113,7 @@ def changeWidget(self, buttonId): # to this container's version of the change-signal try: wdgt.changed.connect(self.widgetOptionsChanged) - except: + except Exception: pass else: wdgt.setVisible(False) @@ -121,7 +121,7 @@ def changeWidget(self, buttonId): # Disconnect non-active widget's changed-signal try: wdgt.changed.disconnect(self.widgetOptionsChanged) - except: + except Exception: pass self.changed.emit() diff --git a/crikit/ui/widget_KK.py b/crikit/ui/widget_KK.py index 17e5c62..3face4d 100644 --- a/crikit/ui/widget_KK.py +++ b/crikit/ui/widget_KK.py @@ -136,7 +136,7 @@ def fcn(self, data_in): nrb = data_in[0] cars = data_in[1] - data_out = _np.zeros(cars.shape, dtype=_np.complex) + data_out = _np.zeros(cars.shape, dtype=complex) cars_amp_offset = self.parameters['cars_amp_offset'] nrb_amp_offset = self.parameters['nrb_amp_offset'] diff --git a/crikit/ui/widget_images.py b/crikit/ui/widget_images.py index e7679f4..dc86a55 100644 --- a/crikit/ui/widget_images.py +++ b/crikit/ui/widget_images.py @@ -246,7 +246,7 @@ def __init__(self, parent = None, **kwargs): cmap=self.colormode.ui.comboBoxColormap.currentText()) try: self.mpl.fig.tight_layout() - except: + except Exception: print('tight_layout failed (widget_images 1') # Insert canvas widget into this widget @@ -337,7 +337,7 @@ def spinBoxMinMaxSet(self): cmap=self.colormode.ui.comboBoxColormap.currentText()) self.mpl.draw() - except: + except Exception: print('Error in spinBoxMinMaxSet') def checkBoxRemOutliers(self): @@ -380,7 +380,7 @@ def checkBoxFixed(self): self.data.compress_low = False else: self.data.compress_low = True - except: + except Exception: pass else: self.data.setmin = None @@ -456,7 +456,7 @@ def __init__(self, parent=None, **kwargs): self.popimage.ui.pushButtonGSPop.setVisible(True) try: self.popimage.ui.pushButtonPop.pressed.disconnect() - except: + except Exception: pass self.popimage.ui.pushButtonPop.pressed.connect(lambda: self.createImg_Ext(img = self.data.image, showcbar=False, @@ -570,7 +570,7 @@ def __init__(self, sgl_color_widget_list = None, parent = None, **kwargs): extent = winextent) try: self.mpl.fig.tight_layout() - except: + except Exception: print('tight_layout failed (widget_image: 3') # Insert mpl widget into this widget @@ -659,7 +659,7 @@ def changeMode(self): extent = self.data.winextent) try: self.mpl.fig.tight_layout() - except: + except Exception: print('tight_layout failed (widget_image: 3') self.mpl.draw() diff --git a/crikit/ui/widget_mergeNRBs.py b/crikit/ui/widget_mergeNRBs.py index 70f1f51..99d8cf0 100644 --- a/crikit/ui/widget_mergeNRBs.py +++ b/crikit/ui/widget_mergeNRBs.py @@ -156,12 +156,12 @@ def fcn(self, data_in): left_side_scale=self.parameters['scale_left']) if self.fullRange: - pix = _np.arange(self.wn.size, dtype=_np.integer) + pix = _np.arange(self.wn.size, dtype=_np.int32) else: list_rng_pix = _find_nearest(self.wn, self.rng)[1] pix = _np.arange(list_rng_pix[0],list_rng_pix[1]+1, - dtype=_np.integer) + dtype=_np.int32) nrb_merged = inst_nrb_merge.calculate() kkd = _np.zeros(data_in.shape) diff --git a/crikit/utils/breadcrumb.py b/crikit/utils/breadcrumb.py index 88c4236..bf344ba 100644 --- a/crikit/utils/breadcrumb.py +++ b/crikit/utils/breadcrumb.py @@ -125,14 +125,14 @@ def dset_name_suffix(self): #print(step[0]) temp = temp + '_' + step[0] return temp - except: + except Exception: return None # METHODS @staticmethod def backup_pickle(data, fname, addl_attr = None): """ - Dump current state of data (class of type crikit.data.spectrum or + Dump current state of data (class of type crikit.data.spectra or subclass)to pickle file (filename= fname). Can append additional attributes (addl_attr) to \ @@ -250,14 +250,14 @@ def pop_to_last(self, all=False): test = BCPre(offset=10) try: test.add_step('Test1') - except: + except Exception: print('Expected Error\n') else: print('Should have raised an error') try: test.add_step(['Test',1]) - except: + except Exception: print('Expected Error\n') else: print('Should have raised an error') diff --git a/crikit/utils/general.py b/crikit/utils/general.py index 716c59b..25eed87 100644 --- a/crikit/utils/general.py +++ b/crikit/utils/general.py @@ -46,7 +46,7 @@ def pad(y, pad_width, mode): shaper_out = list(y.shape) shaper_out[-1] += 2*pad_width y_pad = _np.zeros(shaper_out, dtype=y.dtype) - window = _np.zeros(shaper_out[-1], dtype=_np.integer) + window = _np.zeros(shaper_out[-1], dtype=_np.int32) y_pad[...,pad_width:shaper[-1]+pad_width] = 1*y window[pad_width:shaper[-1]+pad_width] = 1 @@ -120,14 +120,14 @@ def pad_edge_mean(y, pad_width, n_edge=1, axis=-1): """ if pad_width == 0: # No padding - window = _np.ones((y.shape[axis]), dtype=_np.integer) + window = _np.ones((y.shape[axis]), dtype=_np.int32) y_pad = y elif pad_width > 0: orig_shape = y.shape pad_shape = list(orig_shape) pad_shape[axis] += pad_width*2 - window = _np.zeros((pad_shape[axis]), dtype=_np.integer) + window = _np.zeros((pad_shape[axis]), dtype=_np.int32) window[pad_width:-pad_width] = 1 y_pad = _np.zeros(pad_shape, dtype=y.dtype) @@ -183,7 +183,7 @@ def std_nd_to_1d(data, axis=-1): return vec -def arange_nonzero(start, stop, dtype=_np.float): +def arange_nonzero(start, stop, dtype=float): """ Similar to numpy arange but only returns non-zero elements """ diff --git a/docs/build/doctrees/algorithms.doctree b/docs/build/doctrees/algorithms.doctree index dac9ad9..1ca1f2f 100644 Binary files a/docs/build/doctrees/algorithms.doctree and b/docs/build/doctrees/algorithms.doctree differ diff --git a/docs/build/doctrees/api.doctree b/docs/build/doctrees/api.doctree index f19fe69..da04ece 100644 Binary files a/docs/build/doctrees/api.doctree and b/docs/build/doctrees/api.doctree differ diff --git a/docs/build/doctrees/cri_walkthru.doctree b/docs/build/doctrees/cri_walkthru.doctree index 32ab372..1b49e45 100644 Binary files a/docs/build/doctrees/cri_walkthru.doctree and b/docs/build/doctrees/cri_walkthru.doctree differ diff --git a/docs/build/doctrees/crikit.cri.algorithms.doctree b/docs/build/doctrees/crikit.cri.algorithms.doctree index f887f67..a465135 100644 Binary files a/docs/build/doctrees/crikit.cri.algorithms.doctree and b/docs/build/doctrees/crikit.cri.algorithms.doctree differ diff --git a/docs/build/doctrees/crikit.cri.doctree b/docs/build/doctrees/crikit.cri.doctree index 5ff7b53..29f7f44 100644 Binary files a/docs/build/doctrees/crikit.cri.doctree and b/docs/build/doctrees/crikit.cri.doctree differ diff --git a/docs/build/doctrees/crikit.cri.tests.doctree b/docs/build/doctrees/crikit.cri.tests.doctree index 996a093..26f5f3c 100644 Binary files a/docs/build/doctrees/crikit.cri.tests.doctree and b/docs/build/doctrees/crikit.cri.tests.doctree differ diff --git a/docs/build/doctrees/crikit.data.doctree b/docs/build/doctrees/crikit.data.doctree index 92c6778..3372ea7 100644 Binary files a/docs/build/doctrees/crikit.data.doctree and b/docs/build/doctrees/crikit.data.doctree differ diff --git a/docs/build/doctrees/crikit.data.tests.doctree b/docs/build/doctrees/crikit.data.tests.doctree index 94ec82f..2d1f76b 100644 Binary files a/docs/build/doctrees/crikit.data.tests.doctree and b/docs/build/doctrees/crikit.data.tests.doctree differ diff --git a/docs/build/doctrees/crikit.datasets.doctree b/docs/build/doctrees/crikit.datasets.doctree index f5edc6d..9723d79 100644 Binary files a/docs/build/doctrees/crikit.datasets.doctree and b/docs/build/doctrees/crikit.datasets.doctree differ diff --git a/docs/build/doctrees/crikit.doctree b/docs/build/doctrees/crikit.doctree index e825bf8..5437c4f 100644 Binary files a/docs/build/doctrees/crikit.doctree and b/docs/build/doctrees/crikit.doctree differ diff --git a/docs/build/doctrees/crikit.io.doctree b/docs/build/doctrees/crikit.io.doctree index 49ea8cf..34062d0 100644 Binary files a/docs/build/doctrees/crikit.io.doctree and b/docs/build/doctrees/crikit.io.doctree differ diff --git a/docs/build/doctrees/crikit.io.lazy5.doctree b/docs/build/doctrees/crikit.io.lazy5.doctree new file mode 100644 index 0000000..1e38f45 Binary files /dev/null and b/docs/build/doctrees/crikit.io.lazy5.doctree differ diff --git a/docs/build/doctrees/crikit.io.lazy5.tests.doctree b/docs/build/doctrees/crikit.io.lazy5.tests.doctree new file mode 100644 index 0000000..9b97cae Binary files /dev/null and b/docs/build/doctrees/crikit.io.lazy5.tests.doctree differ diff --git a/docs/build/doctrees/crikit.io.lazy5.ui.doctree b/docs/build/doctrees/crikit.io.lazy5.ui.doctree new file mode 100644 index 0000000..2a69670 Binary files /dev/null and b/docs/build/doctrees/crikit.io.lazy5.ui.doctree differ diff --git a/docs/build/doctrees/crikit.io.tests.doctree b/docs/build/doctrees/crikit.io.tests.doctree index f44a16a..3948bb6 100644 Binary files a/docs/build/doctrees/crikit.io.tests.doctree and b/docs/build/doctrees/crikit.io.tests.doctree differ diff --git a/docs/build/doctrees/crikit.measurement.doctree b/docs/build/doctrees/crikit.measurement.doctree index d220697..1b8386a 100644 Binary files a/docs/build/doctrees/crikit.measurement.doctree and b/docs/build/doctrees/crikit.measurement.doctree differ diff --git a/docs/build/doctrees/crikit.measurement.tests.doctree b/docs/build/doctrees/crikit.measurement.tests.doctree index 784ca6a..3170e97 100644 Binary files a/docs/build/doctrees/crikit.measurement.tests.doctree and b/docs/build/doctrees/crikit.measurement.tests.doctree differ diff --git a/docs/build/doctrees/crikit.preprocess.algorithms.doctree b/docs/build/doctrees/crikit.preprocess.algorithms.doctree index 5b4c89f..f09204c 100644 Binary files a/docs/build/doctrees/crikit.preprocess.algorithms.doctree and b/docs/build/doctrees/crikit.preprocess.algorithms.doctree differ diff --git a/docs/build/doctrees/crikit.preprocess.doctree b/docs/build/doctrees/crikit.preprocess.doctree index 253f9f1..e27227b 100644 Binary files a/docs/build/doctrees/crikit.preprocess.doctree and b/docs/build/doctrees/crikit.preprocess.doctree differ diff --git a/docs/build/doctrees/crikit.preprocess.tests.doctree b/docs/build/doctrees/crikit.preprocess.tests.doctree index 1149be0..4510327 100644 Binary files a/docs/build/doctrees/crikit.preprocess.tests.doctree and b/docs/build/doctrees/crikit.preprocess.tests.doctree differ diff --git a/docs/build/doctrees/crikit.transform.doctree b/docs/build/doctrees/crikit.transform.doctree index 804a03c..437a714 100644 Binary files a/docs/build/doctrees/crikit.transform.doctree and b/docs/build/doctrees/crikit.transform.doctree differ diff --git a/docs/build/doctrees/crikit.ui.doctree b/docs/build/doctrees/crikit.ui.doctree index 744327b..b8d0467 100644 Binary files a/docs/build/doctrees/crikit.ui.doctree and b/docs/build/doctrees/crikit.ui.doctree differ diff --git a/docs/build/doctrees/crikit.ui.utils.doctree b/docs/build/doctrees/crikit.ui.utils.doctree index 84b2698..ede53cf 100644 Binary files a/docs/build/doctrees/crikit.ui.utils.doctree and b/docs/build/doctrees/crikit.ui.utils.doctree differ diff --git a/docs/build/doctrees/crikit.utils.doctree b/docs/build/doctrees/crikit.utils.doctree index 35ef262..7f89dea 100644 Binary files a/docs/build/doctrees/crikit.utils.doctree and b/docs/build/doctrees/crikit.utils.doctree differ diff --git a/docs/build/doctrees/crikit.utils.tests.doctree b/docs/build/doctrees/crikit.utils.tests.doctree index cdb70ff..91ffb76 100644 Binary files a/docs/build/doctrees/crikit.utils.tests.doctree and b/docs/build/doctrees/crikit.utils.tests.doctree differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree index b3998f9..e372c15 100644 Binary files a/docs/build/doctrees/index.doctree and b/docs/build/doctrees/index.doctree differ diff --git a/docs/build/doctrees/installing.doctree b/docs/build/doctrees/installing.doctree index 2957df6..9f2ded4 100644 Binary files a/docs/build/doctrees/installing.doctree and b/docs/build/doctrees/installing.doctree differ diff --git a/docs/build/doctrees/io.doctree b/docs/build/doctrees/io.doctree index 0021039..60121c2 100644 Binary files a/docs/build/doctrees/io.doctree and b/docs/build/doctrees/io.doctree differ diff --git a/docs/build/doctrees/license.doctree b/docs/build/doctrees/license.doctree index 8ff6c5c..0a50841 100644 Binary files a/docs/build/doctrees/license.doctree and b/docs/build/doctrees/license.doctree differ diff --git a/docs/build/doctrees/modules.doctree b/docs/build/doctrees/modules.doctree index 6e6622e..0a96a98 100644 Binary files a/docs/build/doctrees/modules.doctree and b/docs/build/doctrees/modules.doctree differ diff --git a/docs/build/doctrees/running.doctree b/docs/build/doctrees/running.doctree index e390fb9..32cd40d 100644 Binary files a/docs/build/doctrees/running.doctree and b/docs/build/doctrees/running.doctree differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index 2f65d65..4f7216a 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: b094f045ad6f469eb719c812c762f46b +config: 79acee3da732a2077d4e910c14203444 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_modules/crikit/CRIkitUI.html b/docs/build/html/_modules/crikit/CRIkitUI.html index 41f3628..8b9477e 100644 --- a/docs/build/html/_modules/crikit/CRIkitUI.html +++ b/docs/build/html/_modules/crikit/CRIkitUI.html @@ -5,15 +5,13 @@ - crikit.CRIkitUI — CRIKit2 0.4.1 documentation - - - + crikit.CRIkitUI — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

Navigation

  • modules |
  • - + @@ -100,14 +98,14 @@

    Source code for crikit.CRIkitUI

     
     from crikit.data.frequency import (calib_pix_wn as _calib_pix_wn,
                                        calib_pix_wl as _calib_pix_wl)
    -from crikit.data.hsi import Hsi
    +from crikit.data.spectra import Hsi
     from crikit.data.spectra import Spectra
    -from crikit.data.spectrum import Spectrum
    +from crikit.data.spectra import Spectrum
     
     from crikit.datasets.model import Model as _Model
     
     from crikit.io.macros import import_csv_nist_special1 as io_nist_dlm
    -from crikit.io.macros import import_hdf_nist_special as io_nist
    +from crikit.io.macros import (import_hdf_nist_special as io_nist, hdf_nist_special_macroraster as io_nist_macro)
     from crikit.io.macros import import_hdf_nist_special_ooc as io_nist_ooc
     
     # from crikit.io.meta_configs import special_nist_bcars2 as _snb2
    @@ -153,14 +151,14 @@ 

    Source code for crikit.CRIkitUI

     
     from sciplot.sciplotUI import SciPlotUI as _SciPlotUI
     
    -import lazy5
    -from lazy5.ui.QtHdfLoad import HdfLoad
    +from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad
    +import crikit.io.lazy5 as lazy5
     
     force_not_sw = False
     
     try:
         import crikit2_sw
    -except:
    +except Exception:
         __sw_installed = False
         # print('SW package not installed, using standard')
         from crikit.ui.dialog_SVD import DialogSVD
    @@ -183,7 +181,7 @@ 

    Source code for crikit.CRIkitUI

     try:
         from crikit.ui.widget_Jupyter import QJupyterWidget
         jupyter_flag = 1
    -except:
    +except Exception:
         print('No appropriate Jupyter/IPython installation found. Console will not be available')
         jupyter_flag = -1
     
    @@ -268,7 +266,7 @@ 

    Source code for crikit.CRIkitUI

             self.ui.sweeperVL.insertWidget(0, self.img_BW, stretch=1, alignment=_QtCore.Qt.AlignHCenter)
             try:
                 self.img_BW.mpl.fig.tight_layout(pad=2)
    -        except:
    +        except Exception:
                 print('tight_layout failed (CrikitUI: 1')
     
             # ID used for matplotlib to connect to a figure
    @@ -330,6 +328,7 @@ 

    Source code for crikit.CRIkitUI

             # Load Data
             self.ui.actionOpenHDFNIST.triggered.connect(self.fileOpenHDFNIST)
             self.ui.actionOpenHDFNISTOOC.triggered.connect(self.fileOpenHDFNISTOOC)
    +        self.ui.actionOpen_HDF_Macro_Raster_NIST.triggered.connect(self.fileOpenHDFMacroRasterNIST)
     
             self.ui.actionLoadNRB.triggered.connect(self.loadNRB)
             self.ui.actionLoadDark.triggered.connect(self.loadDark)
    @@ -462,7 +461,7 @@ 

    Source code for crikit.CRIkitUI

                 try:
                     str_banner = 'Welcome to the embedded ipython console\n\n'
                     self.jupyterConsole = QJupyterWidget(customBanner=str_banner)
    -            except:
    +            except Exception:
                     print('Error loading embedded IPython Notebook')
                 else:
                     self.ui.tabMain.addTab(self.jupyterConsole, 'Jupyter/IPython Console')
    @@ -495,7 +494,7 @@ 

    Source code for crikit.CRIkitUI

             if temp is not None:
                 try:
                     self.fileOpenSuccess(True)
    -            except:
    +            except Exception:
                     print('Error in input hsi')
                     self.hsi = Hsi()
     
    @@ -506,7 +505,7 @@ 

    Source code for crikit.CRIkitUI

                     self.hsi.x = temp
                     self.hsi._x_rep.units = kwargs.get('x_units')
                     self.hsi._x_rep.label = kwargs.get('x_label')
    -            except:
    +            except Exception:
                     print('Error in input x-array')
                     self.hsi.x = None
     
    @@ -517,7 +516,7 @@ 

    Source code for crikit.CRIkitUI

                     self.hsi.y = temp
                     self.hsi._y_rep.units = kwargs.get('y_units')
                     self.hsi._y_rep.label = kwargs.get('y_label')
    -            except:
    +            except Exception:
                     print('Error in input y-array')
                     self.hsi.y = None
     
    @@ -528,7 +527,7 @@ 

    Source code for crikit.CRIkitUI

                     self.hsi.freq._data = temp
                     self.hsi.freq._units = kwargs.get('f_units')
                     self.hsi.freq._label = kwargs.get('f_label')
    -            except:
    +            except Exception:
                     print('Error in input freq-array (f)')
                     self.hsi.freq._data = None
     
    @@ -538,7 +537,7 @@ 

    Source code for crikit.CRIkitUI

                     self.hsi.data = kwargs.get('data')
                     self.hsi.check()
                     self.fileOpenSuccess(True)
    -            except:
    +            except Exception:
                     print('Error in input data')
                     self.hsi = Hsi()
     
    @@ -685,7 +684,7 @@ 

    Source code for crikit.CRIkitUI

             for count in self.bcpre.cut_list:
                 try:
                     _os.remove(count + '.pickle')
    -            except:
    +            except Exception:
                     print('Error in deleting old pickle files')
                 else:
                     del_flag += 1
    @@ -698,11 +697,54 @@ 

    Source code for crikit.CRIkitUI

                 print('Closing HDF File')
                 try:
                     self.fid.close()
    -            except:
    +            except Exception:
                     print('Something failed in closing the file')
                 else:
                     print('Successfully closed HDF File')
    +
    [docs] def fileOpenHDFMacroRasterNIST(self, *args, dialog=True): + """ + Open and load multiple datasets from HDF file that describe a single image. + Used for a macrostage rastering mode at NIST. + + dialog : bool + Present a gui for file and dataset selection + """ + + # Get data and load into CRI_HSI class + # This will need to change to accomodate multiple-file selection + + if dialog: + try: + if (self.filename is not None) & (self.path is not None): + to_open = HdfLoad.getFileDataSets(_os.path.join(self.path, self.filename), parent=self, title='Hyperspectral Image') + else: + to_open = HdfLoad.getFileDataSets(self.path, parent=self, title='Hyperspectral Image') + + print('to_open: {}'.format(to_open)) + if to_open is not None: + self.path, self.filename, self.dataset_name = to_open + except Exception as e: + _traceback.print_exc(limit=1) + print('Could not open file. Corrupt or not appropriate file format: {}'.format(e)) + else: + if to_open is not None: + self.hsi = Hsi() + print('Path: {}'.format(self.path)) + print('filename: {}'.format(self.filename)) + print('dset name: {}'.format(self.dataset_name)) + success = io_nist_macro(self.path, self.filename, self.dataset_name, + self.hsi) + print('Was successful: {}'.format(success)) + print('HSI shape: {}'.format(self.hsi.shape)) + print('Succes: {}'.format(success)) + self.fileOpenSuccess(success) + else: + self.hsi = Hsi() + success = io_nist_macro(self.path, self.filename, self.dataset_name, + self.hsi) + self.fileOpenSuccess(success)
    +
    [docs] def fileOpenHDFNIST(self, *args, dialog=True): """ Open and load HDF5 File @@ -765,7 +807,7 @@

    Source code for crikit.CRIkitUI

                 if to_open is not None:
                     self.path, self.filename, self.dataset_name = to_open
                     self.dataset_name = self.dataset_name[0]
    -        except:
    +        except Exception:
                 print('Could not open file. Corrupt or not appropriate file format.')
             else:
                 if to_open is not None:
    @@ -814,9 +856,9 @@ 

    Source code for crikit.CRIkitUI

             """
             if success:
                 # * If HSI is integer dtype, convert to float
    -            if (self.hsi.data.dtype.kind == 'i') & isinstance(self.hsi.data, _np.ndarray):
    +            if (self.hsi.data.dtype.kind in ['i','u']) & isinstance(self.hsi.data, _np.ndarray):
                     print('Converting HSI from int to float')
    -                self.hsi.data = 1.0*self.hsi.data
    +                self.hsi.data = 1.0 * self.hsi.data
     
                 self.setWindowTitle('{}: {}'.format(self.windowTitle(), self.filename))
                 # FILE
    @@ -980,7 +1022,7 @@ 

    Source code for crikit.CRIkitUI

                 # signal then reconnect (or could have ignored, but this is easier)
                 try:
                     rgb_img.popimage.ui.pushButtonSpectrum.pressed.disconnect()
    -            except:
    +            except Exception:
                     pass
     
                 rgb_img.popimage.ui.pushButtonSpectrum.pressed.connect(self.spectrumColorImg)
    @@ -1015,7 +1057,7 @@ 

    Source code for crikit.CRIkitUI

     
                 if success:
                     # If Dark is integer dtype, convert to float
    -                if self.dark.data.dtype.kind == 'i':
    +                if self.dark.data.dtype.kind in ['u', 'i']:
                         print('Converting Dark from int to float')
                         self.dark.data = 1.0*self.dark.data
     
    @@ -1060,7 +1102,7 @@ 

    Source code for crikit.CRIkitUI

     
                 if success:
                     # If Dark is integer dtype, convert to float
    -                if self.dark.data.dtype.kind == 'i':
    +                if self.dark.data.dtype.kind in ['u', 'i']:
                         print('Converting Dark from int to float')
                         self.dark.data = 1.0*self.dark.data
     
    @@ -1104,7 +1146,7 @@ 

    Source code for crikit.CRIkitUI

                 success = io_nist(pth, filename, datasets, nrb)
                 if success:
                     # If NRB is integer dtype, convert to float
    -                if nrb.data.dtype.kind == 'i':
    +                if nrb.data.dtype.kind in ['u', 'i']:
                         print('Converting NRB from int to float')
                         nrb.data = 1.0*nrb.data
     
    @@ -1239,7 +1281,7 @@ 

    Source code for crikit.CRIkitUI

                     self.img_BW.mpl.ax.add_artist(lg)
                 try:
                     self.img_BW.mpl.fig.tight_layout(pad=1)
    -            except:
    +            except Exception:
                     print('tight_layout failed (CrikitUI: 2')
                 self.img_BW.mpl.draw()
    @@ -1259,8 +1301,8 @@

    Source code for crikit.CRIkitUI

     
                     if len(self.x_loc_list) == 1:
                         self.img_BW.mpl.ax.plot(self.x_loc_list, self.y_loc_list,
    -                                            markerfacecolor=[.9, .9, 0],
    -                                            markeredgecolor=[.9, .9, 0],
    +                                            markerfacecolor=[.9, .9, 0],
    +                                            markeredgecolor=[.9, .9, 0],
                                                 marker='+',
                                                 markersize=10,
                                                 linestyle='None')
    @@ -1273,9 +1315,9 @@ 

    Source code for crikit.CRIkitUI

                                                 linewidth=2,
                                                 marker='+',
                                                 markersize=10,
    -                                            color=[.9, .9, 0],
    -                                            markerfacecolor=[.9, .9, 0],
    -                                            markeredgecolor=[.9, .9, 0])
    +                                            color=[.9, .9, 0],
    +                                            markerfacecolor=[.9, .9, 0],
    +                                            markeredgecolor=[.9, .9, 0])
                         self.img_BW.mpl.ax.set_xlim(getx)
                         self.img_BW.mpl.ax.set_ylim(gety)
     
    @@ -1290,9 +1332,9 @@ 

    Source code for crikit.CRIkitUI

                                             linewidth=2,
                                             marker='+',
                                             markersize=10,
    -                                        color=[.9, .9, 0],
    -                                        markerfacecolor=[.9, .9, 0],
    -                                        markeredgecolor=[.9, .9, 0])
    +                                        color=[.9, .9, 0],
    +                                        markerfacecolor=[.9, .9, 0],
    +                                        markeredgecolor=[.9, .9, 0])
                     self.img_BW.mpl.ax.set_xlim(getx)
                     self.img_BW.mpl.ax.set_ylim(gety)
                     self.img_BW.mpl.draw()
    @@ -1651,7 +1693,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -1955,8 +1997,8 @@ 

    Source code for crikit.CRIkitUI

     
                     if len(self.x_loc_list) == 1:
                         self.img_BW.mpl.ax.plot(self.x_loc_list, self.y_loc_list,
    -                                            markerfacecolor=[.9, .9, 0],
    -                                            markeredgecolor=[.9, .9, 0],
    +                                            markerfacecolor=[.9, .9, 0],
    +                                            markeredgecolor=[.9, .9, 0],
                                                 marker='+',
                                                 markersize=10,
                                                 linestyle='None')
    @@ -1969,9 +2011,9 @@ 

    Source code for crikit.CRIkitUI

                                                 linewidth=2,
                                                 marker='+',
                                                 markersize=10,
    -                                            color=[.9, .9, 0],
    -                                            markerfacecolor=[.9, .9, 0],
    -                                            markeredgecolor=[.9, .9, 0])
    +                                            color=[.9, .9, 0],
    +                                            markerfacecolor=[.9, .9, 0],
    +                                            markeredgecolor=[.9, .9, 0])
                         self.img_BW.mpl.ax.set_xlim(getx)
                         self.img_BW.mpl.ax.set_ylim(gety)
     
    @@ -2027,7 +2069,7 @@ 

    Source code for crikit.CRIkitUI

     
                 self.ui.freqSlider.setSliderPosition(pos)
                 self.changeSlider()
    -        except:
    +        except Exception:
                 pass
    [docs] def lineEditPixChanged(self): @@ -2100,7 +2142,7 @@

    Source code for crikit.CRIkitUI

             try:
                 currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxOperations.currentText()
                 self.img_RGB_list[rgbnum].data.operation = currentop
    -        except:
    +        except Exception:
                 pass
    [docs] def condOpChange(self): @@ -2112,7 +2154,7 @@

    Source code for crikit.CRIkitUI

             try:
                 currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxCondOps.currentText()
                 self.img_RGB_list[rgbnum].data.condoperation = currentop
    -        except:
    +        except Exception:
                 pass
    [docs] def condInEqualityChange(self): @@ -2124,7 +2166,7 @@

    Source code for crikit.CRIkitUI

             try:
                 currentop = self.img_RGB_list[rgbnum].math.ui.comboBoxCondInEquality.currentText()
                 self.img_RGB_list[rgbnum].data.inequality = currentop
    -        except:
    +        except Exception:
                 pass
    [docs] def spinBoxInEqualityChange(self): @@ -2136,7 +2178,7 @@

    Source code for crikit.CRIkitUI

             try:
                 self.img_RGB_list[rgbnum].data.inequalityval = \
                     self.img_RGB_list[rgbnum].math.ui.spinBoxInEquality.value()
    -        except:
    +        except Exception:
                 pass
    [docs] def doKK(self): @@ -2162,7 +2204,7 @@

    Source code for crikit.CRIkitUI

                     conj = True
                 else:
                     conj = False
    -        except:
    +        except Exception:
                 conj = False
     
             out = DialogKKOptions.dialogKKOptions(data=[self.hsi.f,
    @@ -2206,7 +2248,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2307,7 +2349,7 @@

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2378,7 +2420,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2424,7 +2466,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2499,7 +2541,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2519,7 +2561,7 @@ 

    Source code for crikit.CRIkitUI

             for count in self.bcpre.cut_list:
                 try:
                     _os.remove(count + '.pickle')
    -            except:
    +            except Exception:
                     print('Error in deleting old pickle files')
                 else:
                     del_flag += 1
    @@ -2565,7 +2607,7 @@ 

    Source code for crikit.CRIkitUI

                         if self.ui.actionUndo_Backup_Enabled.isChecked():
                             try:
                                 _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                        except:
    +                        except Exception:
                                 print('Error in pickle backup (Undo functionality)')
                             else:
                                 self.bcpre.backed_up()
    @@ -2700,7 +2742,7 @@ 

    Source code for crikit.CRIkitUI

                         if self.ui.actionUndo_Backup_Enabled.isChecked():
                             try:
                                 _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                        except:
    +                        except Exception:
                                 print('Error in pickle backup (Undo functionality)')
                             else:
                                 self.bcpre.backed_up()
    @@ -2741,7 +2783,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -2773,7 +2815,7 @@ 

    Source code for crikit.CRIkitUI

                 if self.ui.actionUndo_Backup_Enabled.isChecked():
                     try:
                         _BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
    -                except:
    +                except Exception:
                         print('Error in pickle backup (Undo functionality)')
                     else:
                         self.bcpre.backed_up()
    @@ -3056,7 +3098,7 @@ 

    Source code for crikit.CRIkitUI

     
                 self.img_RGB_list[rgbnum].mpl.draw()
     
    -        except:
    +        except Exception:
                 print('Error')
             self.doComposite()
    @@ -3071,7 +3113,7 @@

    Source code for crikit.CRIkitUI

     
                 self.img_RGB_list[rgbnum].data.opfreq2 = currentfreq
                 self.img_RGB_list[rgbnum].math.ui.pushButtonOpFreq2.setText(str(round(currentfreq, 1)))
    -        except:
    +        except Exception:
                 pass
    [docs] def setOpFreq3(self): @@ -3086,7 +3128,7 @@

    Source code for crikit.CRIkitUI

                 self.img_RGB_list[rgbnum].data.opfreq3 = currentfreq
                 self.img_RGB_list[rgbnum].math.ui.pushButtonOpFreq3.setText(str(round(currentfreq, 1)))
     
    -        except:
    +        except Exception:
                 pass
    [docs] def setCondFreq1(self): @@ -3101,7 +3143,7 @@

    Source code for crikit.CRIkitUI

                 self.img_RGB_list[rgbnum].data.condfreq1 = currentfreq
                 self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq1.setText(str(round(currentfreq, 1)))
     
    -        except:
    +        except Exception:
                 print('Error')
    [docs] def setCondFreq2(self): @@ -3116,7 +3158,7 @@

    Source code for crikit.CRIkitUI

                 self.img_RGB_list[rgbnum].data.condfreq2 = currentfreq
                 self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq2.setText(str(round(currentfreq, 1)))
     
    -        except:
    +        except Exception:
                 print('Error')
    [docs] def setCondFreq3(self): @@ -3131,7 +3173,7 @@

    Source code for crikit.CRIkitUI

                 self.img_RGB_list[rgbnum].data.condfreq3 = currentfreq
                 self.img_RGB_list[rgbnum].math.ui.pushButtonCondFreq3.setText(str(round(currentfreq, 1)))
     
    -        except:
    +        except Exception:
                 print('Error')
    [docs] def spectrumColorImg(self): @@ -3154,7 +3196,7 @@

    Source code for crikit.CRIkitUI

             else:
     
                 Mask = Mask > 0
    -            Mask = Mask.astype(_np.integer)
    +            Mask = Mask.astype(_np.int32)
     
                 mask_hits = Mask.sum()
     
    @@ -3296,7 +3338,7 @@ 

    Source code for crikit.CRIkitUI

                 if self._mpl_v1:
                     self.img_BW.mpl.ax.hold(True)
     
    -        except:
    +        except Exception:
                 print('Error in changeSlider: display img_BW')
     
             try:
    @@ -3338,11 +3380,11 @@ 

    Source code for crikit.CRIkitUI

                                 self.img_BW.mpl.ax.add_artist(lg)
                                 try:
                                     self.img_BW.mpl.fig.tight_layout(pad=1)
    -                            except:
    +                            except Exception:
                                     print('tight_layout failed (CrikitUI: 3')
    -                        except:
    +                        except Exception:
                                 print('Error in showing overlay legend')
    -        except:
    +        except Exception:
                 print('Error in changeSlider: display overlays')
     
             self.img_BW.mpl.draw()
    @@ -3418,7 +3460,7 @@ 

    Source code for crikit.CRIkitUI

                                               yunits=self.img_Composite2.data.yunits,
                                               extent=self.img_BW.data.winextent)
                 self.img_Composite2.mpl.draw()
    -        except:
    +        except Exception:
                 print('Error in doComposite')
    [docs] def updateOverlays(self): @@ -3703,7 +3745,7 @@

    Source code for crikit.CRIkitUI

                         img_shape = fid[dataset_name].shape
                         self._mosaic_mask = _np.zeros(img_shape)
                         fid[dataset_name].read_direct(self._mosaic_mask)
    -                    n_imgs = self._mosaic_mask.max().astype(_np.int)
    +                    n_imgs = self._mosaic_mask.max().astype(int)
                         fid.close()
                 
                 msg = _QMessageBox(self)
    @@ -3750,7 +3792,7 @@ 

    Source code for crikit.CRIkitUI

     
         Input kwargs (Optional)
         ------------------------
    -    hsi : crikit.data.Hsi
    +    hsi : crikit.data.spectra.Hsi
             Hsi instance
     
         data : ndarray (3D)
    @@ -3847,7 +3889,7 @@ 

    Source code for crikit.CRIkitUI

       

    Quick search

    @@ -3866,14 +3908,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/algorithms/kk.html b/docs/build/html/_modules/crikit/cri/algorithms/kk.html index 08d6348..eed0de9 100644 --- a/docs/build/html/_modules/crikit/cri/algorithms/kk.html +++ b/docs/build/html/_modules/crikit/cri/algorithms/kk.html @@ -5,15 +5,13 @@ - crikit.cri.algorithms.kk — CRIKit2 0.4.1 documentation - - - + crikit.cri.algorithms.kk — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -136,7 +134,7 @@

    Source code for crikit.cri.algorithms.kk

             ratio[ratio <= 0] = bad_value
     
         if (ratio.ndim == 3) & ((axis == -1) | (axis == 2)) & (not no_iter):
    -        ph = _np.zeros(ratio.shape, dtype = _np.complex)
    +        ph = _np.zeros(ratio.shape, dtype = complex)
             for num in range(ratio.shape[0]):
                 ph[num, ...] = _np.exp(1j * (hilbertfft(0.5 * _np.log(ratio[num, ...]), **hilb_kwargs) + phase_offset))
         else:
    @@ -257,7 +255,7 @@ 

    Source code for crikit.cri.algorithms.kk

       

    Quick search

    @@ -276,14 +274,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/error_correction.html b/docs/build/html/_modules/crikit/cri/error_correction.html index 043b2b9..edbe546 100644 --- a/docs/build/html/_modules/crikit/cri/error_correction.html +++ b/docs/build/html/_modules/crikit/cri/error_correction.html @@ -5,15 +5,13 @@ - crikit.cri.error_correction — CRIKit2 0.4.1 documentation - - - + crikit.cri.error_correction — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -198,7 +196,7 @@

    Source code for crikit.cri.error_correction

                     # else:
                     ret_obj[idx][..., self.rng] *= correction_factor
                     counter += 1
    -        except:
    +        except Exception:
                 return False
             else:
     #            print(self._inst_als.__dict__)
    @@ -267,7 +265,7 @@ 

    Source code for crikit.cri.error_correction

                     ret_obj *= correction_factor
                 else:
                     ret_obj[..., self.rng] *= correction_factor
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -338,7 +336,7 @@ 

    Source code for crikit.cri.error_correction

       

    Quick search

    @@ -357,14 +355,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/kk.html b/docs/build/html/_modules/crikit/cri/kk.html index f9ac0de..d354005 100644 --- a/docs/build/html/_modules/crikit/cri/kk.html +++ b/docs/build/html/_modules/crikit/cri/kk.html @@ -5,15 +5,13 @@ - crikit.cri.kk — CRIKit2 0.4.1 documentation - - - + crikit.cri.kk — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -236,12 +234,12 @@

    Source code for crikit.cri.kk

                 Nonresonant background (NRB)
             """
     
    -        kkd = _np.zeros(cars.shape, dtype=_np.complex)
    +        kkd = _np.zeros(cars.shape, dtype=complex)
             self._calc(cars, nrb, ret_obj=kkd)
             return kkd
    def _transform(self, cars, nrb): - if issubclass(cars.dtype.type, _np.complex): + if issubclass(cars.dtype.type, complex): success = self._calc(cars, nrb, ret_obj=cars) return success else: @@ -250,15 +248,15 @@

    Source code for crikit.cri.kk

     
     if __name__ == '__main__': # pragma: no cover
     
    -    from crikit.data.spectrum import Spectrum as _Spectrum
    +    from crikit.data.spectra import Spectrum as _Spectrum
         from crikit.data.spectra import Spectra as _Spectra
    -    from crikit.data.hsi import Hsi as _Hsi
    +    from crikit.data.spectra import Hsi as _Hsi
     
         hsi = _Hsi()
         nrb = _Spectra()
     
         WN = _np.linspace(-1386,3826,400)
    -    X = .055 + 1/(1000-WN-1j*20) + 1/(3000-WN-1j*20)
    +    X = .055 + 1/(1000-WN-1j*20) + 1/(3000-WN-1j*20)
         XNR = 0*X + 0.055
         E = 1*_np.exp(-(WN-2000)**2/(2*3000**2))
     
    @@ -346,7 +344,7 @@ 

    Source code for crikit.cri.kk

       

    Quick search

    @@ -365,14 +363,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/merge_nrbs.html b/docs/build/html/_modules/crikit/cri/merge_nrbs.html index 16d94e9..30323fd 100644 --- a/docs/build/html/_modules/crikit/cri/merge_nrbs.html +++ b/docs/build/html/_modules/crikit/cri/merge_nrbs.html @@ -5,15 +5,13 @@ - crikit.cri.merge_nrbs — CRIKit2 0.4.1 documentation - - - + crikit.cri.merge_nrbs — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -114,7 +112,7 @@

    Source code for crikit.cri.merge_nrbs

                     
                 else:
                     raise ValueError('self.scale_left must be True, False, or None')
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -158,7 +156,7 @@

    Source code for crikit.cri.merge_nrbs

       

    Quick search

    @@ -177,14 +175,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_hilbert.html b/docs/build/html/_modules/crikit/cri/tests/test_hilbert.html index edcd85d..2d03c9b 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_hilbert.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_hilbert.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_hilbert — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_hilbert — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -99,7 +97,7 @@

    Source code for crikit.cri.tests.test_hilbert

    Quick search
    @@ -118,14 +116,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_kk.html b/docs/build/html/_modules/crikit/cri/tests/test_kk.html index d8308b6..f89b2dc 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_kk.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_kk.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_kk — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_kk — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -87,7 +85,7 @@

    Source code for crikit.cri.tests.test_kk

     
    [docs]def test_kk_transform(): x = np.linspace(-100, 100, 1000) y = 2/(2**2 + x**2) - y_complex = y.astype(np.complex) + y_complex = y.astype(complex) kk = KramersKronig(norm_to_nrb=False) success = kk._transform(y_complex, 0*y_complex + 1) @@ -98,7 +96,7 @@

    Source code for crikit.cri.tests.test_kk

     
    [docs]def test_kk_transform_fail(): x = np.linspace(-100, 100, 1000) y = 2/(2**2 + x**2) - y_complex = y.astype(np.complex) + y_complex = y.astype(complex) kk = KramersKronig(norm_to_nrb=False) @@ -142,7 +140,7 @@

    Source code for crikit.cri.tests.test_kk

       

    Quick search

    @@ -161,14 +159,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_kk_alg.html b/docs/build/html/_modules/crikit/cri/tests/test_kk_alg.html index 0f649b4..aa7e76e 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_kk_alg.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_kk_alg.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_kk_alg — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_kk_alg — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -95,7 +93,7 @@

    Source code for crikit.cri.tests.test_kk_alg

    Quick search
         
    @@ -114,14 +112,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_merge_nrbs.html b/docs/build/html/_modules/crikit/cri/tests/test_merge_nrbs.html index 830431e..aed1f6c 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_merge_nrbs.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_merge_nrbs.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_merge_nrbs — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_merge_nrbs — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -76,7 +74,7 @@

    Source code for crikit.cri.tests.test_merge_nrbs

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_pec.html b/docs/build/html/_modules/crikit/cri/tests/test_pec.html index 98ad3b0..93f9a91 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_pec.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_pec.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_pec — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_pec — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -425,7 +423,7 @@

    Source code for crikit.cri.tests.test_pec

       

    Quick search

    @@ -444,14 +442,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/cri/tests/test_sec.html b/docs/build/html/_modules/crikit/cri/tests/test_sec.html index cb29327..9d16642 100644 --- a/docs/build/html/_modules/crikit/cri/tests/test_sec.html +++ b/docs/build/html/_modules/crikit/cri/tests/test_sec.html @@ -5,15 +5,13 @@ - crikit.cri.tests.test_sec — CRIKit2 0.4.1 documentation - - - + crikit.cri.tests.test_sec — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -95,7 +93,7 @@

    Source code for crikit.cri.tests.test_sec

       

    Quick search

    @@ -114,14 +112,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/factorized.html b/docs/build/html/_modules/crikit/data/factorized.html index 4015a6e..33808a8 100644 --- a/docs/build/html/_modules/crikit/data/factorized.html +++ b/docs/build/html/_modules/crikit/data/factorized.html @@ -5,15 +5,13 @@ - crikit.data.factorized — CRIKit2 0.4.1 documentation - - - + crikit.data.factorized — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -49,10 +47,10 @@

    Source code for crikit.data.factorized

     import numpy as _np
     
     from crikit.data.frequency import Frequency as _Frequency
    -from crikit.data.spectrum import Spectrum as _Spectrum
    +from crikit.data.spectra import Spectrum as _Spectrum
     from crikit.data.spectra import Spectra as _Spectra
     from crikit.data.replicate import Replicate as _Replicate
    -from crikit.data.hsi import Hsi as _Hsi
    +from crikit.data.spectra import Hsi as _Hsi
     
     class _Factorized:
         """
    @@ -110,7 +108,7 @@ 

    Source code for crikit.data.factorized

       

    Quick search

    @@ -129,14 +127,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/frequency.html b/docs/build/html/_modules/crikit/data/frequency.html index 04d9cb5..ffbbbd8 100644 --- a/docs/build/html/_modules/crikit/data/frequency.html +++ b/docs/build/html/_modules/crikit/data/frequency.html @@ -5,15 +5,13 @@ - crikit.data.frequency — CRIKit2 0.4.1 documentation - - - + crikit.data.frequency — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -517,7 +515,7 @@

    Source code for crikit.data.frequency

       

    Quick search

    @@ -536,14 +534,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/hsi.html b/docs/build/html/_modules/crikit/data/hsi.html deleted file mode 100644 index d5d9ac3..0000000 --- a/docs/build/html/_modules/crikit/data/hsi.html +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - crikit.data.hsi — CRIKit2 0.4.1 documentation - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Source code for crikit.data.hsi

    -"""
    -Hyperspectral imagery (hsi) class
    -
    -Created on Tue Apr 12 13:06:30 2016
    -
    -@author: chc
    -"""
    -
    -import numpy as _np
    -import copy as _copy
    -
    -from crikit.data.frequency import Frequency as _Frequency
    -from crikit.data.spectrum import Spectrum as _Spectrum
    -from crikit.data.replicate import Replicate as _Replicate
    -
    -__all__ = ['Hsi']
    -
    -
    [docs]class Hsi(_Spectrum): - """ - Hyperspectral imagery class - - Parameters - ---------- - data : 3D ndarray [y_pix, x_pix, f_pix] - HSI image - - mask : 3D ndarray (int) [y_pix, x_pix, f_pix] - 0,1 mask with 1 is a usable pixel and 0 is not - - freq : crikit.data.frequency.Frequency instance - Frequency [wavelength, wavenumber] object (i.e., the independent \ - variable) - - label : str - Image label (i.e., a string describing what the image is) - - units : str - Units of image (e.g., intensity) - - x_rep : crikit.data.replicate.Replicate instance, Not implemented yet - x-axis spatial object - - y_rep : crikit.data.replicate.Replicate instance, Not implemented yet - x-axis spatial object - - x : 1D ndarray - x-axis spatial vector - - y : 1D ndarray - y-axis spatial vector - - meta : dict - Meta-data dictionary - - Attributes - ---------- - shape : tuple, read-only - Shape of data - - size : int, read-only - Size of data (i.e., total number of entries) - - Methods - ------- - mean : 1D ndarray - Mean spectrum. If extent [a,b] is provided, calculate mean over that\ - inclusive region. - - std : 1D ndarray - Standard deviation of spectrum. If extent [a,b] is provided, calculate standard\ - deviation over that inclusive region. - - subtract : 3D ndarray or None - Subtract spectrum or object - - Notes - ----- - * freq object contains some useful parameters such as op_range_* and \ - plot_range_*, which define spectral regions-of-interest. (It's debatable \ - as to whether those parameters should be in Frequency or Spectrum classes) - - """ - - # Configurations - config = {} - config['nd_axis'] = -1 - - def __init__(self, data=None, freq=None, x=None, y=None, x_rep=None, - y_rep=None, label=None, units=None, meta=None): - - super().__init__(data, freq, label, units, meta) - self._x_rep = _Replicate() - self._y_rep = _Replicate() - self._mask = None - - self._x_rep = _Replicate(data=x) - self._y_rep = _Replicate(data=y) - - if x is None and x_rep is not None: - self.x_rep = _copy.deepcopy(x_rep) - if y is None and y_rep is not None: - self.y_rep = _copy.deepcopy(y_rep) - - @staticmethod - def _mean_axes(*args, **kwargs): - """ Inhereted from Spectrum """ - raise NotImplementedError('Only applicable to Spectrum class.') - - @staticmethod - def _reshape_axes(shape, spectral_axis): - """ - Parameters - ---------- - shape : tuple - Input data shape - - spectral_axis : int - Spectral axis - - Returns - ------- - Reshape vector - """ - ndim = len(shape) - - if ndim == 1: - out = [1, 1, 1] - out[spectral_axis] = shape[0] - elif ndim == 2: # ! Super-wonky - out = [1, shape[0], shape[1]] - elif ndim == 3: - out = shape - elif ndim > 3: - out = [-1, shape[-2], shape[-1]] - else: - raise ValueError('Shape error') - - return tuple(out) - - @property - def mask(self): - return self._mask - - @property - def x_rep(self): - return self._x_rep - - @x_rep.setter - def x_rep(self, value): - if isinstance(value, _Replicate): - self._x_rep = value - elif isinstance(value, _np.ndarray): - self._x_rep.data = value - - @property - def y_rep(self): - return self._y_rep - - @property - def x(self): - return self._x_rep.data - - @x.setter - def x(self, value): - self._x_rep.data = value - - @property - def y(self): - return self._y_rep.data - - @y.setter - def y(self, value): - self._y_rep.data = value - - - @y_rep.setter - def y_rep(self, value): - if isinstance(value, _Replicate): - self._y_rep = value - elif isinstance(value, _np.ndarray): - self._y_rep.data = value - - @property - def data(self): - return self._data - - @data.setter - def data(self, value): - if not isinstance(value, _np.ndarray): - raise TypeError('data must be of type ndarray, not {}'.format(type(value))) - - ax_rs = self._reshape_axes(value.shape, self.config['nd_axis']) - - # self._mask = _np.ones(tuple([n for n in range(3) if n != self.config['nd_axis']]), - # dtype=_np.int) - - if self.freq is None or self.freq.op_list_pix is None: - self._data = value.reshape(ax_rs) - else: - if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: - temp = _np.zeros((self._data.shape),dtype=value.dtype) - temp[:,:,self.freq.op_range_pix] = value.reshape(ax_rs) - self._data = 1*temp - del temp - elif value.shape[self.config['nd_axis']] == self._data.shape[self.config['nd_axis']]: - temp = _np.zeros((self._data.shape),dtype=value.dtype) - temp[..., self.freq.op_range_pix] = value.reshape(ax_rs)[..., self.freq.op_range_pix] - self._data = 1*temp - del temp - -
    [docs] def check(self): - """ - Check x, y, and freq to make sure the dimensions agree with data - """ - if self._data is None: - print('Hsi check: data is None, not checking') - else: - if self._x_rep._data is None: - self._x_rep._data = _np.arange(self.shape[1]) - self._x_rep._label = 'X' - self._x_rep._units = 'pix' - print('Hsi check: setting x to pixels') - elif self._x_rep._data.size != self._data.shape[1]: - self._x_rep = _Replicate() - self._x_rep._data = _np.arange(self.shape[1]) - self._x_rep._label = 'X' - self._x_rep._units = 'pix' - print('Hsi check: setting x to pixels') - - if self._y_rep._data is None: - self._y_rep._data = _np.arange(self.shape[0]) - self._y_rep._label = 'Y' - self._y_rep._units = 'pix' - print('Hsi check: setting y to pixels') - elif self._y_rep._data.size != self._data.shape[0]: - self._y_rep = _Replicate() - self._y_rep._data = _np.arange(self.shape[0]) - self._y_rep._label = 'Y' - self._y_rep._units = 'pix' - print('Hsi check: setting y to pixels') - - if self.freq._data is None: - self.freq._data = _np.arange(self.shape[-1]) - self.freq._label = 'Frequency' - self.freq._units = 'pix' - print('Hsi check: setting freq to pixels') - elif self.freq._data.size != self._data.shape[-1]: - self.freq = _Frequency() - self.freq._data = _np.arange(self.shape[-1]) - print('Hsi check: setting freq to pixels') - return None
    - -
    [docs] def subtract(self, spectra, overwrite=True): - """ - Subtract spectrum from data - """ - # Order IS important - if isinstance(spectra, Hsi): - if overwrite: - self.data -= spectra.data - return None - else: - return self.data - spectra.data - elif isinstance(spectra, _Spectrum): - if overwrite: - self.data -= spectra.data[None,None,:] - return None - else: - return self.data - spectra.data - elif isinstance(spectra, _np.ndarray): - if spectra.shape == self.data.shape: - if overwrite: - self.data -= spectra - return None - else: - return self.data - spectra - else: - if overwrite: - self.data -= spectra[None,None,:] - return None - else: - return self.data - spectra[None,None,:]
    - -
    [docs] def get_rand_spectra(self, num, pt_sz=1, quads=False, full=False): - - mlen, nlen, freqlen = self.data.shape - - if quads: - num_spectra = num + 5 - else: - num_spectra = num - - if _np.iscomplexobj(self.data): - dtype = _np.complex - else: - dtype = _np.float - - temp = _np.zeros((num_spectra, self.data.shape[-1]), dtype=dtype) - - quad_mid_row = int(_np.round(mlen/2)) - quad_mid_col = int(_np.round(nlen/2)) - center_row = (int(_np.round(mlen/3)), int(_np.round(2*mlen/3))) - center_col = (int(_np.round(nlen/3)), int(_np.round(2*nlen/3))) - - start_count = 0 - if quads: - # QUADS - # Bottom-left - temp[0, :] = _np.mean(self.data[0:quad_mid_row, 0:quad_mid_col, :], axis=(0, 1)) - - # Upper-left - temp[1, :] = _np.mean(self.data[0:quad_mid_row, quad_mid_col+1::, :], axis=(0, 1)) - - # Upper-right - temp[2, :] = _np.mean(self.data[quad_mid_row+1::, quad_mid_col+1::, :], axis=(0, 1)) - - # Bottom-right - temp[3, :] = _np.mean(self.data[quad_mid_row+1::, 0:quad_mid_col, :], axis=(0, 1)) - - # Center - temp[4, :] = _np.mean(self.data[center_row[0]:center_row[1], center_col[0]:center_col[1], :], axis=(0, 1)) - - start_count += 5 - else: - pass - - rand_rows = ((mlen-pt_sz-1)*_np.random.rand(num_spectra)).astype(int) - rand_cols = ((nlen-pt_sz-1)*_np.random.rand(num_spectra)).astype(int) - - for count in _np.arange(start_count,num_spectra): - if pt_sz == 1: - temp[count, :] = _np.squeeze(self.data[rand_rows[count-start_count], - rand_cols[count-start_count]]) - else: - - rows = [rand_rows[count-start_count]-(pt_sz-1), - rand_rows[count-start_count]+pt_sz] - cols = [rand_cols[count-start_count]-(pt_sz-1), - rand_cols[count-start_count]+pt_sz] - - if rows[0] < 0: - rows[0] = 0 - if rows[1] >= mlen: - rows[1] = mlen-1 - if cols[0] < 0: - cols[0] = 0 - if cols[1] >= nlen: - cols[1] = nlen-1 - - if cols[0] == cols[1] or rows[0] == rows[1]: - pass - else: - temp[count,:] = _np.squeeze(_np.mean(self.data[rows[0]:rows[1], cols[0]:cols[1], :], axis=(0, 1))) - - if (not full) and (self.freq.data is not None): - temp = temp[..., self.freq.op_range_pix] - - return temp
    - - def __sub__(self, spectrum): - return self.subtract(spectrum, overwrite=False)
    - -if __name__ == '__main__': # pragma: no cover - - x = _np.linspace(0,100,10) - y = _np.linspace(0,100,10) - freq = _np.arange(20) - data = _np.random.rand(10,10,20) - - - hs = Hsi(data=data, freq=freq, x=x, y=y) - print(hs.shape) - print(isinstance(hs, _Spectrum)) -
    - -
    -
    -
    -
    - -
    -
    - - - - \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/mosaic.html b/docs/build/html/_modules/crikit/data/mosaic.html index 7587a6a..3de90cd 100644 --- a/docs/build/html/_modules/crikit/data/mosaic.html +++ b/docs/build/html/_modules/crikit/data/mosaic.html @@ -5,15 +5,13 @@ - crikit.data.mosaic — CRIKit2 0.4.1 documentation - - - + crikit.data.mosaic — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -161,11 +159,11 @@

    Source code for crikit.data.mosaic

                 dt = [q.dtype.kind for q in self._data]
     
                 if dt.count('c') > 0:
    -                return _np.complex
    +                return complex
                 elif dt.count('f') > 0:
    -                return _np.float
    +                return float
                 elif dt.count('i') > 0:
    -                return _np.int
    +                return int
     
     
     
    [docs] def mosaic_shape(self, shape=None, idx=None): @@ -288,7 +286,7 @@

    Source code for crikit.data.mosaic

                                 data = sub_img_counter * \
                                        _np.ones(self._data[sub_img_counter][slice_sub_r,
                                                                             slice_sub_c].shape[0:2],
    -                                           dtype=_np.int)
    +                                           dtype=int)
                             elif idx is None:
                                 data = self._data[sub_img_counter][slice_sub_r, slice_sub_c]
                             else:
    @@ -388,7 +386,7 @@ 

    Source code for crikit.data.mosaic

         assert mos.shape == tuple(n*[new_obj.shape])
         assert mos.size == n
         assert mos.issamedim
    -    assert mos.dtype == _np.float
    +    assert mos.dtype == float
     
         # AFFECTED BY START* END*
         assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop)
    @@ -426,7 +424,7 @@ 

    Source code for crikit.data.mosaic

       

    Quick search

    @@ -445,14 +443,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/replicate.html b/docs/build/html/_modules/crikit/data/replicate.html index 5eb4512..ad5a9bb 100644 --- a/docs/build/html/_modules/crikit/data/replicate.html +++ b/docs/build/html/_modules/crikit/data/replicate.html @@ -5,15 +5,13 @@ - crikit.data.replicate — CRIKit2 0.4.1 documentation - - - + crikit.data.replicate — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -214,7 +212,7 @@

    Source code for crikit.data.replicate

     
         start = 0
         stop = 10
    -    step_size = .1
    +    step_size = .1
     
         x = _np.arange(start, stop, step_size)
     
    @@ -233,7 +231,7 @@ 

    Source code for crikit.data.replicate

       

    Quick search

    @@ -252,14 +250,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/spectra.html b/docs/build/html/_modules/crikit/data/spectra.html index e65dd3d..9da3a52 100644 --- a/docs/build/html/_modules/crikit/data/spectra.html +++ b/docs/build/html/_modules/crikit/data/spectra.html @@ -5,15 +5,13 @@ - crikit.data.spectra — CRIKit2 0.4.1 documentation - - - + crikit.data.spectra — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -48,12 +46,733 @@

    Source code for crikit.data.spectra

     import copy as _copy
     
     from crikit.data.frequency import Frequency as _Frequency
    -from crikit.data.spectrum import Spectrum as _Spectrum
     from crikit.data.replicate import Replicate as _Replicate
     
    -__all__ = ['Spectra']
    +__all__ = ['Spectrum', 'Spectra', 'Hsi']
     
    -
    [docs]class Spectra(_Spectrum): + +
    [docs]class Spectrum: + """ + Spectrum class + + Attributes + ---------- + data : 1D ndarray [f_pix] + Spectrum + + freq : crikit.data.Frequency instance + Frequency [wavelength, wavenumber] object (i.e., the independent \ + variable) + + label : str + Spectrum label (i.e., a string describing what the spectrum is) + + units : str + Units of spectrum + + meta : dict + Meta-data dictionary + + f_pix : int, read-only + Size of data. Note: this matches the size of data and does NOT check \ + the size of freq.freq_vec. + + ndim : int, read-only + Number of data dimensions + + shape : tuple, read-only + Shape of data + + size : int, read-only + Size of data (i.e., total number of entries) + + Methods + ------- + mean : int + Mean value. If extent [a,b] is provided, calculate mean over that\ + inclusive region. + + std : int + Standard deviation. If extent [a,b] is provided, calculate standard\ + deviation over that inclusive region. + + subtract : 1D ndarray or None + Subtract spectrum or object + + Notes + ----- + * freq object contains some useful parameters such as op_range* and \ + plot_range*, which define spectral regions-of-interest. (It's debatable \ + as to whether those parameters should be in Frequency or Spectrum classes) + + """ + + # Configurations + config = {} + config['nd_axis'] = -1 + config['nd_fcn'] = _np.mean + + def __init__(self, data=None, freq=None, label=None, units=None, meta=None): + + self._data = None + self._freq = _Frequency() + self._label = None + self._units = None + self._meta = {} + + if data is not None: + self.data = _copy.deepcopy(data) + if freq is not None: + self.freq = _copy.deepcopy(freq) + else: + self.freq = _Frequency() + if label is not None: + self.label = _copy.deepcopy(label) + if units is not None: + self.units = _copy.deepcopy(units) + if meta is not None: + self._meta = _copy.deepcopy(meta) + + @staticmethod + def _mean_axes(ndim, axis): + """ + Parameters + ---------- + ndim : int + Number of dimensions of input data (target is 1D spectrum) + + axis : int + For ND data, axis is remaining axis + + Returns + ------- + Vector that describes what axes to operate (using a mean or similar method) with + axis parameter + """ + if axis < 0: + axis2 = ndim + axis + else: + axis2 = axis + return tuple([n for n in range(ndim) if n != axis2]) + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, _np.ndarray): + raise TypeError('data must be of type ndarray') + + # If sub-range of operation is defined. Only perform action over op_range_pix + if self.freq is not None and self.freq.op_list_pix is not None: + if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: + temp = _np.zeros((self.freq.size), dtype=value.dtype) + if value.ndim == 1: + temp[self.freq.op_range_pix] = value + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax) + elif value.shape[self.config['nd_axis']] == self.freq.size: + temp = _np.zeros((self.freq.size), dtype=value.dtype) + if value.ndim == 1: + temp[self.freq.op_range_pix] = value[self.freq.op_range_pix] + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax)[self.freq.op_range_pix] + + else: + raise TypeError('data is of an unrecognized shape: {}'.format(value.shape)) + self._data = 1 * temp + del temp + else: + if value.ndim == 1: + self._data = value + else: + print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) + nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) + self._data = self.config['nd_fcn'](value, axis=nd_ax) + + @property + def freq(self): + return self._freq + + @freq.setter + def freq(self, value): + if isinstance(value, _Frequency): + self._freq = value + elif isinstance(value, _np.ndarray): + self.freq = _Frequency(data=value) + else: + raise TypeError('freq must be of type crikit.data.Frequency') + + @property + def f(self): + """ + Convenience attribute: return frequency vector within operating (op) \ + range + """ + return self.freq.op_range_freq + + @property + def f_full(self): + """ + Convenience attribute: return full frequency vector + """ + return self.freq.data + + @property + def units(self): + return self._units + + @units.setter + def units(self, value): + if isinstance(value, str): + self._units = value + else: + raise TypeError('units must be of type str') + + @property + def label(self): + return self._label + + @label.setter + def label(self, value): + if isinstance(value, str): + self._label = value + else: + raise TypeError('label must be of type str') + + @property + def meta(self): + temp_dict = self._meta.copy() + + if self.freq.calib is not None: + try: + calib_dict = {} + calib_prefix = 'Calib.' + + calib_dict[calib_prefix + 'a_vec'] = self.freq.calib['a_vec'] + calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib['ctr_wl'] + calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib['ctr_wl0'] + calib_dict[calib_prefix + 'n_pix'] = self.freq.calib['n_pix'] + calib_dict[calib_prefix + 'probe'] = self.freq.calib['probe'] + + try: # Doesn't really matter if we have the units + calib_dict[calib_prefix + 'units'] = self.freq.calib['units'] + except Exception: + pass + + except Exception: + print('Could not get calibration information') + else: + temp_dict.update(calib_dict) + + if self.freq.calib_orig is not None: + try: + calib_dict = {} + calib_prefix = 'CalibOrig.' + + calib_dict[calib_prefix + 'a_vec'] = self.freq.calib_orig['a_vec'] + calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib_orig['ctr_wl'] + calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib_orig['ctr_wl0'] + calib_dict[calib_prefix + 'n_pix'] = self.freq.calib_orig['n_pix'] + calib_dict[calib_prefix + 'probe'] = self.freq.calib_orig['probe'] + + try: # Doesn't really matter if we have the units + calib_dict[calib_prefix + 'units'] = self.freq.calib_orig['units'] + except Exception: + pass + + except Exception: + print('Could not get calibration information') + else: + temp_dict.update(calib_dict) + + # return self._meta + return temp_dict + + @meta.setter + def meta(self, value): + if isinstance(value, dict): + self._meta = value + else: + raise TypeError('meta must be of type dict') + + @property + def f_pix(self): + if self._data is not None: + return self._data.shape[-1] + + @property + def ndim(self): + if self._data is None: + return None + elif isinstance(self._data, _np.ndarray): + return self._data.ndim + else: + return len(self._data.shape) + + @property + def shape(self): + if self._data is None: + return None + else: + return self._data.shape + + @property + def size(self): + if self._data is None: + return None + else: + return self._data.size + +
    [docs] def mean(self, extent=None, over_space=True): + """ + Return mean spectrum (or mean over extent [list with 2 elements]). If\ + over_space is False, returns reps-number of mean spectra + """ + if self._data is None: + return None + + ndim = len(self._data.shape) + + if ndim == 1: + if isinstance(self._data, _np.ndarray): + return self._data.mean() + else: + return _np.mean(self._data) + + if ndim > 1: + if over_space is True: + axes = tuple(_np.arange(ndim - 1)) + else: + axes = -1 + + if isinstance(self._data, _np.ndarray): + if extent is None: + return self._data.mean(axis=axes) + else: + return self._data[:, extent[0]:extent[1] + 1].mean(axis=axes) + else: + if extent is None: + return _np.mean(self._data, axis=axes) + else: + return _np.mean(self._data[:, extent[0]:extent[1] + 1], + axis=axes)
    + +
    [docs] def std(self, extent=None, over_space=True): + """ + Return standard deviation (std) spectrum (or std over extent + [list with 2 elements]). If over_space is False, reps (or reps x reps) + number of std's. + """ + if self._data is None: + return None + + ndim = len(self._data.shape) + + if ndim == 1: + if isinstance(self._data, _np.ndarray): + return self._data.std() + else: + return _np.std(self._data) + + if ndim > 1: + if over_space is True: + axes = tuple(_np.arange(ndim - 1)) + else: + axes = -1 + + if isinstance(self._data, _np.ndarray): + if extent is None: + return self._data.std(axis=axes) + else: + return self._data[:, extent[0]:extent[1] + 1].std(axis=axes) + else: + if extent is None: + return _np.std(self._data, axis=axes) + else: + return _np.std(self._data[:, extent[0]:extent[1] + 1], + axis=axes)
    + +
    [docs] def subtract(self, spectrum, overwrite=True): + """ + Subtract spectrum from data + """ + if isinstance(spectrum, Spectrum): + if overwrite: + self.data -= spectrum.data + return None + else: + return self.data - spectrum.data + elif isinstance(spectrum, _np.ndarray): + if overwrite: + self.data -= spectrum + return None + else: + return self.data - spectrum
    + + def __sub__(self, spectrum): + return self.subtract(spectrum, overwrite=False)
    + + +
    [docs]class Hsi(Spectrum): + """ + Hyperspectral imagery class + + Parameters + ---------- + data : 3D ndarray [y_pix, x_pix, f_pix] + HSI image + + mask : 3D ndarray (int) [y_pix, x_pix, f_pix] + 0,1 mask with 1 is a usable pixel and 0 is not + + freq : crikit.data.frequency.Frequency instance + Frequency [wavelength, wavenumber] object (i.e., the independent \ + variable) + + label : str + Image label (i.e., a string describing what the image is) + + units : str + Units of image (e.g., intensity) + + x_rep : crikit.data.replicate.Replicate instance, Not implemented yet + x-axis spatial object + + y_rep : crikit.data.replicate.Replicate instance, Not implemented yet + x-axis spatial object + + x : 1D ndarray + x-axis spatial vector + + y : 1D ndarray + y-axis spatial vector + + meta : dict + Meta-data dictionary + + Attributes + ---------- + shape : tuple, read-only + Shape of data + + size : int, read-only + Size of data (i.e., total number of entries) + + extent : list, read-only + Extent of image [xmin, xmax, ymin, ymax] + + Methods + ------- + mean : 1D ndarray + Mean spectrum. If extent [a,b] is provided, calculate mean over that\ + inclusive region. + + std : 1D ndarray + Standard deviation of spectrum. If extent [a,b] is provided, calculate standard\ + deviation over that inclusive region. + + subtract : 3D ndarray or None + Subtract spectrum or object + + Notes + ----- + * freq object contains some useful parameters such as op_range_* and \ + plot_range_*, which define spectral regions-of-interest. (It's debatable \ + as to whether those parameters should be in Frequency or Spectrum classes) + + """ + + # Configurations + config = {} + config['nd_axis'] = -1 + + def __init__(self, data=None, freq=None, x=None, y=None, x_rep=None, + y_rep=None, label=None, units=None, meta=None): + + super().__init__(data, freq, label, units, meta) + self._x_rep = _Replicate() + self._y_rep = _Replicate() + self._mask = None + + self._x_rep = _Replicate(data=x) + self._y_rep = _Replicate(data=y) + + if x is None and x_rep is not None: + self.x_rep = _copy.deepcopy(x_rep) + if y is None and y_rep is not None: + self.y_rep = _copy.deepcopy(y_rep) + + @staticmethod + def _mean_axes(*args, **kwargs): + """ Inhereted from Spectrum """ + raise NotImplementedError('Only applicable to Spectrum class.') + + @staticmethod + def _reshape_axes(shape, spectral_axis): + """ + Parameters + ---------- + shape : tuple + Input data shape + + spectral_axis : int + Spectral axis + + Returns + ------- + Reshape vector + """ + ndim = len(shape) + + if ndim == 1: + out = [1, 1, 1] + out[spectral_axis] = shape[0] + elif ndim == 2: # ! Super-wonky + out = [1, shape[0], shape[1]] + elif ndim == 3: + out = shape + elif ndim > 3: + out = [-1, shape[-2], shape[-1]] + else: + raise ValueError('Shape error') + + return tuple(out) + + @property + def extent(self): + if (self.x is not None) & (self.y is not None): + return [self.x.min(), self.x.max(), self.y.min(), self.y.max()] + + @property + def mask(self): + return self._mask + + @property + def x_rep(self): + return self._x_rep + + @x_rep.setter + def x_rep(self, value): + if isinstance(value, _Replicate): + self._x_rep = value + elif isinstance(value, _np.ndarray): + self._x_rep.data = value + + @property + def y_rep(self): + return self._y_rep + + @property + def x(self): + return self._x_rep.data + + @x.setter + def x(self, value): + self._x_rep.data = value + + @property + def y(self): + return self._y_rep.data + + @y.setter + def y(self, value): + self._y_rep.data = value + + @y_rep.setter + def y_rep(self, value): + if isinstance(value, _Replicate): + self._y_rep = value + elif isinstance(value, _np.ndarray): + self._y_rep.data = value + + @property + def data(self): + return self._data + + @data.setter + def data(self, value): + if not isinstance(value, _np.ndarray): + raise TypeError('data must be of type ndarray, not {}'.format(type(value))) + + ax_rs = self._reshape_axes(value.shape, self.config['nd_axis']) + + # self._mask = _np.ones(tuple([n for n in range(3) if n != self.config['nd_axis']]), + # dtype=int) + + if self.freq is None or self.freq.op_list_pix is None: + self._data = value.reshape(ax_rs) + else: + if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: + temp = _np.zeros((self._data.shape), dtype=value.dtype) + temp[:, :, self.freq.op_range_pix] = value.reshape(ax_rs) + self._data = 1 * temp + del temp + elif value.shape[self.config['nd_axis']] == self._data.shape[self.config['nd_axis']]: + temp = _np.zeros((self._data.shape), dtype=value.dtype) + temp[..., self.freq.op_range_pix] = value.reshape(ax_rs)[..., self.freq.op_range_pix] + self._data = 1 * temp + del temp + +
    [docs] def check(self): + """ + Check x, y, and freq to make sure the dimensions agree with data + """ + if self._data is None: + print('Hsi check: data is None, not checking') + else: + if self._x_rep._data is None: + self._x_rep._data = _np.arange(self.shape[1]) + self._x_rep._label = 'X' + self._x_rep._units = 'pix' + print('Hsi check: setting x to pixels') + elif self._x_rep._data.size != self._data.shape[1]: + self._x_rep = _Replicate() + self._x_rep._data = _np.arange(self.shape[1]) + self._x_rep._label = 'X' + self._x_rep._units = 'pix' + print('Hsi check: setting x to pixels') + + if self._y_rep._data is None: + self._y_rep._data = _np.arange(self.shape[0]) + self._y_rep._label = 'Y' + self._y_rep._units = 'pix' + print('Hsi check: setting y to pixels') + elif self._y_rep._data.size != self._data.shape[0]: + self._y_rep = _Replicate() + self._y_rep._data = _np.arange(self.shape[0]) + self._y_rep._label = 'Y' + self._y_rep._units = 'pix' + print('Hsi check: setting y to pixels') + + if self.freq._data is None: + self.freq._data = _np.arange(self.shape[-1]) + self.freq._label = 'Frequency' + self.freq._units = 'pix' + print('Hsi check: setting freq to pixels') + elif self.freq._data.size != self._data.shape[-1]: + self.freq = _Frequency() + self.freq._data = _np.arange(self.shape[-1]) + print('Hsi check: setting freq to pixels') + return None
    + +
    [docs] def subtract(self, spectra, overwrite=True): + """ + Subtract spectrum from data + """ + # Order IS important + if isinstance(spectra, Hsi): + if overwrite: + self.data -= spectra.data + return None + else: + return self.data - spectra.data + elif isinstance(spectra, Spectrum): + if overwrite: + self.data -= spectra.data[None, None, :] + return None + else: + return self.data - spectra.data + elif isinstance(spectra, _np.ndarray): + if spectra.shape == self.data.shape: + if overwrite: + self.data -= spectra + return None + else: + return self.data - spectra + else: + if overwrite: + self.data -= spectra[None, None, :] + return None + else: + return self.data - spectra[None, None, :]
    + +
    [docs] def get_rand_spectra(self, num, pt_sz=1, quads=False, full=False): + + mlen, nlen, freqlen = self.data.shape + + if quads: + num_spectra = num + 5 + else: + num_spectra = num + + if _np.iscomplexobj(self.data): + dtype = complex + else: + dtype = float + + temp = _np.zeros((num_spectra, self.data.shape[-1]), dtype=dtype) + + quad_mid_row = int(_np.round(mlen / 2)) + quad_mid_col = int(_np.round(nlen / 2)) + center_row = (int(_np.round(mlen / 3)), int(_np.round(2 * mlen / 3))) + center_col = (int(_np.round(nlen / 3)), int(_np.round(2 * nlen / 3))) + + start_count = 0 + if quads: + # QUADS + # Bottom-left + temp[0, :] = _np.mean(self.data[0:quad_mid_row, 0:quad_mid_col, :], axis=(0, 1)) + + # Upper-left + temp[1, :] = _np.mean(self.data[0:quad_mid_row, quad_mid_col + 1::, :], axis=(0, 1)) + + # Upper-right + temp[2, :] = _np.mean(self.data[quad_mid_row + 1::, quad_mid_col + 1::, :], axis=(0, 1)) + + # Bottom-right + temp[3, :] = _np.mean(self.data[quad_mid_row + 1::, 0:quad_mid_col, :], axis=(0, 1)) + + # Center + temp[4, :] = _np.mean(self.data[center_row[0]:center_row[1], center_col[0]:center_col[1], :], axis=(0, 1)) + + start_count += 5 + else: + pass + + rand_rows = ((mlen - pt_sz - 1) * _np.random.rand(num_spectra)).astype(int) + rand_cols = ((nlen - pt_sz - 1) * _np.random.rand(num_spectra)).astype(int) + + for count in _np.arange(start_count, num_spectra): + if pt_sz == 1: + temp[count, :] = _np.squeeze(self.data[rand_rows[count - start_count], + rand_cols[count - start_count]]) + else: + + rows = [rand_rows[count - start_count] - (pt_sz - 1), + rand_rows[count - start_count] + pt_sz] + cols = [rand_cols[count - start_count] - (pt_sz - 1), + rand_cols[count - start_count] + pt_sz] + + if rows[0] < 0: + rows[0] = 0 + if rows[1] >= mlen: + rows[1] = mlen - 1 + if cols[0] < 0: + cols[0] = 0 + if cols[1] >= nlen: + cols[1] = nlen - 1 + + if cols[0] == cols[1] or rows[0] == rows[1]: + pass + else: + temp[count, :] = _np.squeeze(_np.mean(self.data[rows[0]:rows[1], cols[0]:cols[1], :], axis=(0, 1))) + + if (not full) and (self.freq.data is not None): + temp = temp[..., self.freq.op_range_pix] + + return temp
    + + def __sub__(self, spectrum): + return self.subtract(spectrum, overwrite=False)
    + + +
    [docs]class Spectra(Spectrum): """ Spectra class @@ -165,7 +884,7 @@

    Source code for crikit.data.spectra

                     print('Spectra: converting data input from {}D to 2D ndarray'.format(value.ndim))
                 if value.shape[-1] == self.freq.op_range_pix.size:
                     temp = _np.zeros((self._data.shape), dtype=value.dtype)
    -                temp[:,self.freq.op_range_pix] = value
    +                temp[:, self.freq.op_range_pix] = value
                     self._data = temp
                 elif value.shape[-1] == self.freq.size:
                     temp = _np.zeros((self._data.shape), dtype=value.dtype)
    @@ -200,12 +919,12 @@ 

    Source code for crikit.data.spectra

                     return None
                 else:
                     return self.data - spectra.data
    -        elif isinstance(spectra, _Spectrum):
    +        elif isinstance(spectra, Spectrum):
                 if overwrite:
    -                self.data -= spectra.data[None,:]
    +                self.data -= spectra.data[None, :]
                     return None
                 else:
    -                return self.data - spectra.data[None,:]
    +                return self.data - spectra.data[None, :]
             elif isinstance(spectra, _np.ndarray):
                 if spectra.shape == self.data.shape:
                     if overwrite:
    @@ -215,22 +934,23 @@ 

    Source code for crikit.data.spectra

                         return self.data - spectra
                 else:
                     if overwrite:
    -                    self.data -= spectra[None,:]
    +                    self.data -= spectra[None, :]
                         return None
                     else:
    -                    return self.data - spectra[None,:]
    + return self.data - spectra[None, :]
    def __sub__(self, spectrum): return self.subtract(spectrum, overwrite=False)
    -if __name__ == '__main__': # pragma: no cover + +if __name__ == '__main__': # pragma: no cover sp = Spectra() print(sp.__dict__) - print('Subclass? : {}'.format(issubclass(Spectra,_Spectrum))) - print('Instance of Spectra? : {}'.format(isinstance(sp,Spectra))) - print('Instance of Spectrum? : {}'.format(isinstance(sp,_Spectrum))) - print('Type(sp) == Spectrum? : {}'.format(type(sp)==_Spectrum)) - print('Type(sp) == Spectra? : {}'.format(type(sp)==Spectra)) + print('Subclass? : {}'.format(issubclass(Spectra, Spectrum))) + print('Instance of Spectra? : {}'.format(isinstance(sp, Spectra))) + print('Instance of Spectrum? : {}'.format(isinstance(sp, Spectrum))) + print('Type(sp) == Spectrum? : {}'.format(type(sp) == Spectrum)) + print('Type(sp) == Spectra? : {}'.format(type(sp) == Spectra))
    @@ -243,7 +963,7 @@

    Source code for crikit.data.spectra

       

    Quick search

    @@ -262,14 +982,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/spectrum.html b/docs/build/html/_modules/crikit/data/spectrum.html deleted file mode 100644 index 27fea60..0000000 --- a/docs/build/html/_modules/crikit/data/spectrum.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - - - crikit.data.spectrum — CRIKit2 0.4.1 documentation - - - - - - - - - - - - - -
    -
    -
    -
    - -

    Source code for crikit.data.spectrum

    -"""
    -Spectrum class and function
    -
    -"""
    -
    -import numpy as _np
    -import copy as _copy
    -
    -from crikit.data.frequency import Frequency as _Frequency
    -
    -__all__ = ['Spectrum']
    -
    -
    [docs]class Spectrum: - """ - Spectrum class - - Attributes - ---------- - data : 1D ndarray [f_pix] - Spectrum - - freq : crikit.data.Frequency instance - Frequency [wavelength, wavenumber] object (i.e., the independent \ - variable) - - label : str - Spectrum label (i.e., a string describing what the spectrum is) - - units : str - Units of spectrum - - meta : dict - Meta-data dictionary - - f_pix : int, read-only - Size of data. Note: this matches the size of data and does NOT check \ - the size of freq.freq_vec. - - ndim : int, read-only - Number of data dimensions - - shape : tuple, read-only - Shape of data - - size : int, read-only - Size of data (i.e., total number of entries) - - Methods - ------- - mean : int - Mean value. If extent [a,b] is provided, calculate mean over that\ - inclusive region. - - std : int - Standard deviation. If extent [a,b] is provided, calculate standard\ - deviation over that inclusive region. - - subtract : 1D ndarray or None - Subtract spectrum or object - - Notes - ----- - * freq object contains some useful parameters such as op_range* and \ - plot_range*, which define spectral regions-of-interest. (It's debatable \ - as to whether those parameters should be in Frequency or Spectrum classes) - - """ - - # Configurations - config = {} - config['nd_axis'] = -1 - config['nd_fcn'] = _np.mean - - def __init__(self, data=None, freq=None, label=None, units=None, meta=None): - - self._data = None - self._freq = _Frequency() - self._label = None - self._units = None - self._meta = {} - - if data is not None: - self.data = _copy.deepcopy(data) - if freq is not None: - self.freq = _copy.deepcopy(freq) - else: - self.freq = _Frequency() - if label is not None: - self.label = _copy.deepcopy(label) - if units is not None: - self.units = _copy.deepcopy(units) - if meta is not None: - self._meta = _copy.deepcopy(meta) - - @staticmethod - def _mean_axes(ndim, axis): - """ - Parameters - ---------- - ndim : int - Number of dimensions of input data (target is 1D spectrum) - - axis : int - For ND data, axis is remaining axis - - Returns - ------- - Vector that describes what axes to operate (using a mean or similar method) with - axis parameter - """ - if axis < 0: - axis2 = ndim + axis - else: - axis2 = axis - return tuple([n for n in range(ndim) if n != axis2]) - - @property - def data(self): - return self._data - - @data.setter - def data(self, value): - if not isinstance(value, _np.ndarray): - raise TypeError('data must be of type ndarray') - - # If sub-range of operation is defined. Only perform action over op_range_pix - if self.freq is not None and self.freq.op_list_pix is not None: - if value.shape[self.config['nd_axis']] == self.freq.op_range_pix.size: - temp = _np.zeros((self.freq.size), dtype=value.dtype) - if value.ndim == 1: - temp[self.freq.op_range_pix] = value - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax) - elif value.shape[self.config['nd_axis']] == self.freq.size: - temp = _np.zeros((self.freq.size), dtype=value.dtype) - if value.ndim == 1: - temp[self.freq.op_range_pix] = value[self.freq.op_range_pix] - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - temp[self.freq.op_range_pix] = self.config['nd_fcn'](value, axis=nd_ax)[self.freq.op_range_pix] - - else: - raise TypeError('data is of an unrecognized shape: {}'.format(value.shape)) - self._data = 1*temp - del temp - else: - if value.ndim == 1: - self._data = value - else: - print('Input data is {}-dim. Performing {}'.format(value.ndim, self.config['nd_fcn'].__name__)) - nd_ax = self._mean_axes(value.ndim, axis=self.config['nd_axis']) - self._data = self.config['nd_fcn'](value, axis=nd_ax) - - - @property - def freq(self): - return self._freq - - @freq.setter - def freq(self, value): - if isinstance(value, _Frequency): - self._freq = value - elif isinstance(value, _np.ndarray): - self.freq = _Frequency(data=value) - else: - raise TypeError('freq must be of type crikit.data.Frequency') - - @property - def f(self): - """ - Convenience attribute: return frequency vector within operating (op) \ - range - """ - return self.freq.op_range_freq - - @property - def f_full(self): - """ - Convenience attribute: return full frequency vector - """ - return self.freq.data - - @property - def units(self): - return self._units - - @units.setter - def units(self, value): - if isinstance(value, str): - self._units = value - else: - raise TypeError('units must be of type str') - - @property - def label(self): - return self._label - - @label.setter - def label(self, value): - if isinstance(value, str): - self._label = value - else: - raise TypeError('label must be of type str') - - @property - def meta(self): - temp_dict = self._meta.copy() - - if self.freq.calib is not None: - try: - calib_dict = {} - calib_prefix = 'Calib.' - - calib_dict[calib_prefix + 'a_vec'] = self.freq.calib['a_vec'] - calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib['ctr_wl'] - calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib['ctr_wl0'] - calib_dict[calib_prefix + 'n_pix'] = self.freq.calib['n_pix'] - calib_dict[calib_prefix + 'probe'] = self.freq.calib['probe'] - - try: # Doesn't really matter if we have the units - calib_dict[calib_prefix + 'units'] = self.freq.calib['units'] - except: - pass - - except: - print('Could not get calibration information') - else: - temp_dict.update(calib_dict) - - if self.freq.calib_orig is not None: - try: - calib_dict = {} - calib_prefix = 'CalibOrig.' - - calib_dict[calib_prefix + 'a_vec'] = self.freq.calib_orig['a_vec'] - calib_dict[calib_prefix + 'ctr_wl'] = self.freq.calib_orig['ctr_wl'] - calib_dict[calib_prefix + 'ctr_wl0'] = self.freq.calib_orig['ctr_wl0'] - calib_dict[calib_prefix + 'n_pix'] = self.freq.calib_orig['n_pix'] - calib_dict[calib_prefix + 'probe'] = self.freq.calib_orig['probe'] - - try: # Doesn't really matter if we have the units - calib_dict[calib_prefix + 'units'] = self.freq.calib_orig['units'] - except: - pass - - except: - print('Could not get calibration information') - else: - temp_dict.update(calib_dict) - - # return self._meta - return temp_dict - - @meta.setter - def meta(self, value): - if isinstance(value, dict): - self._meta = value - else: - raise TypeError('meta must be of type dict') - - @property - def f_pix(self): - if self._data is not None: - return self._data.shape[-1] - - @property - def ndim(self): - if self._data is None: - return None - elif isinstance(self._data, _np.ndarray): - return self._data.ndim - else: - return len(self._data.shape) - - @property - def shape(self): - if self._data is None: - return None - else: - return self._data.shape - - @property - def size(self): - if self._data is None: - return None - else: - return self._data.size - -
    [docs] def mean(self, extent=None, over_space=True): - """ - Return mean spectrum (or mean over extent [list with 2 elements]). If\ - over_space is False, returns reps-number of mean spectra - """ - if self._data is None: - return None - - ndim = len(self._data.shape) - - if ndim == 1: - if isinstance(self._data, _np.ndarray): - return self._data.mean() - else: - return _np.mean(self._data) - - if ndim > 1: - if over_space == True: - axes = tuple(_np.arange(ndim-1)) - else: - axes = -1 - - if isinstance(self._data, _np.ndarray): - if extent is None: - return self._data.mean(axis=axes) - else: - return self._data[:,extent[0]:extent[1]+1].mean(axis=axes) - else: - if extent is None: - return _np.mean(self._data, axis=axes) - else: - return _np.mean(self._data[:,extent[0]:extent[1]+1], - axis=axes)
    - -
    [docs] def std(self, extent=None, over_space=True): - """ - Return standard deviation (std) spectrum (or std over extent - [list with 2 elements]). If over_space is False, reps (or reps x reps) - number of std's. - """ - if self._data is None: - return None - - ndim = len(self._data.shape) - - if ndim == 1: - if isinstance(self._data, _np.ndarray): - return self._data.std() - else: - return _np.std(self._data) - - if ndim > 1: - if over_space == True: - axes = tuple(_np.arange(ndim-1)) - else: - axes = -1 - - if isinstance(self._data, _np.ndarray): - if extent is None: - return self._data.std(axis=axes) - else: - return self._data[:,extent[0]:extent[1]+1].std(axis=axes) - else: - if extent is None: - return _np.std(self._data, axis=axes) - else: - return _np.std(self._data[:,extent[0]:extent[1]+1], - axis=axes)
    - -
    [docs] def subtract(self, spectrum, overwrite=True): - """ - Subtract spectrum from data - """ - if isinstance(spectrum, Spectrum): - if overwrite: - self.data -= spectrum.data - return None - else: - return self.data - spectrum.data - elif isinstance(spectrum, _np.ndarray): - if overwrite: - self.data -= spectrum - return None - else: - return self.data - spectrum
    - - def __sub__(self, spectrum): - return self.subtract(spectrum, overwrite=False)
    - - -if __name__ == '__main__': # pragma: no cover - import timeit as _timeit - - N = 10001 - wn = _np.linspace(500,3000,N) - sp = Spectrum(data=_np.random.rand(N) + 1j*_np.random.rand(N), freq=wn) - - tmr = _timeit.default_timer() - sp.data[200:500] - tmr -= _timeit.default_timer() - print(-tmr) -
    - -
    -
    -
    -
    - -
    -
    - - - - \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/tests/test_hsi.html b/docs/build/html/_modules/crikit/data/tests/test_hsi.html index 4245dd0..f595941 100644 --- a/docs/build/html/_modules/crikit/data/tests/test_hsi.html +++ b/docs/build/html/_modules/crikit/data/tests/test_hsi.html @@ -5,15 +5,13 @@ - crikit.data.tests.test_hsi — CRIKit2 0.4.1 documentation - - - + crikit.data.tests.test_hsi — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,12 +41,12 @@

    Source code for crikit.data.tests.test_hsi

     import numpy.testing
     
     import pytest
    -import lazy5
    +import crikit.io.lazy5 as lazy5
     
     from crikit.io.hdf5 import hdf_import_data
    -from crikit.data.spectrum import Spectrum
    +from crikit.data.spectra import Spectrum
     from crikit.data.spectra import Spectra
    -from crikit.data.hsi import Hsi
    +from crikit.data.spectra import Hsi
     
     
    [docs]@pytest.fixture(scope="function") def make_datasets(): @@ -171,7 +169,7 @@

    Source code for crikit.data.tests.test_hsi

       

    Quick search

    @@ -190,14 +188,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/tests/test_mosaic.html b/docs/build/html/_modules/crikit/data/tests/test_mosaic.html index 51222d8..d7d21a6 100644 --- a/docs/build/html/_modules/crikit/data/tests/test_mosaic.html +++ b/docs/build/html/_modules/crikit/data/tests/test_mosaic.html @@ -5,15 +5,13 @@ - crikit.data.tests.test_mosaic — CRIKit2 0.4.1 documentation - - - + crikit.data.tests.test_mosaic — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -82,7 +80,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop) @@ -130,7 +128,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -183,7 +181,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -240,7 +238,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float # AFFECTED BY START* END* assert mos.unitshape == (m_obj_crop, n_obj_crop, p_obj_crop) @@ -282,7 +280,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float assert mos.unitshape == (m_obj, n_obj) assert mos.unitshape_orig == (m_obj, n_obj) @@ -318,7 +316,7 @@

    Source code for crikit.data.tests.test_mosaic

    assert mos.shape == tuple(n*[new_obj.shape]) assert mos.size == n assert mos.issamedim - assert mos.dtype == np.float + assert mos.dtype == float with pytest.raises(ValueError): mos.mosaic2d((m_side, n_side)).shape @@ -519,7 +517,7 @@

    Source code for crikit.data.tests.test_mosaic

    Quick search
    @@ -538,14 +536,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/tests/test_mosaic_hdf.html b/docs/build/html/_modules/crikit/data/tests/test_mosaic_hdf.html index 7025a48..6bcf042 100644 --- a/docs/build/html/_modules/crikit/data/tests/test_mosaic_hdf.html +++ b/docs/build/html/_modules/crikit/data/tests/test_mosaic_hdf.html @@ -5,15 +5,13 @@ - crikit.data.tests.test_mosaic_hdf — CRIKit2 0.4.1 documentation - - - + crikit.data.tests.test_mosaic_hdf — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -45,7 +43,7 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    import pytest import h5py -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.data.mosaic import Mosaic @@ -71,7 +69,7 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    time.sleep(1) try: os.remove(filename) - except: + except Exception: print('Could not delete {}'.format(filename))
    [docs]def test_hdf2(hdf_dataset2): @@ -141,13 +139,13 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out))
    [docs]def test_big_to_small_3d_output_given_crop(): @@ -212,13 +210,13 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out))
    [docs]def test_big_to_small_3d_output_given_crop_transpose_flips(): @@ -284,13 +282,13 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    time.sleep(1) try: os.remove(filename_in) - except: + except Exception: print('Could not delete {}'.format(filename_in)) time.sleep(1) try: os.remove(filename_out) - except: + except Exception: print('Could not delete {}'.format(filename_out))
    @@ -304,7 +302,7 @@

    Source code for crikit.data.tests.test_mosaic_hdf

    Quick search
    @@ -323,14 +321,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/tests/test_spectra.html b/docs/build/html/_modules/crikit/data/tests/test_spectra.html index b139cf5..18f0078 100644 --- a/docs/build/html/_modules/crikit/data/tests/test_spectra.html +++ b/docs/build/html/_modules/crikit/data/tests/test_spectra.html @@ -5,15 +5,13 @@ - crikit.data.tests.test_spectra — CRIKit2 0.4.1 documentation - - - + crikit.data.tests.test_spectra — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,12 +41,12 @@

    Source code for crikit.data.tests.test_spectra

    import numpy.testing import pytest -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi

    [docs]@pytest.fixture(scope="function") def make_datasets(): @@ -171,7 +169,7 @@

    Source code for crikit.data.tests.test_spectra

    Quick search

    @@ -190,14 +188,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/data/tests/test_spectrum.html b/docs/build/html/_modules/crikit/data/tests/test_spectrum.html index 6d045f8..6be11cd 100644 --- a/docs/build/html/_modules/crikit/data/tests/test_spectrum.html +++ b/docs/build/html/_modules/crikit/data/tests/test_spectrum.html @@ -5,15 +5,13 @@ - crikit.data.tests.test_spectrum — CRIKit2 0.4.1 documentation - - - + crikit.data.tests.test_spectrum — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,12 +41,12 @@

    Source code for crikit.data.tests.test_spectrum

    < import numpy.testing import pytest -import lazy5 +import crikit.io.lazy5 as lazy5 from crikit.io.hdf5 import hdf_import_data -from crikit.data.spectrum import Spectrum +from crikit.data.spectra import Spectrum from crikit.data.spectra import Spectra -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi
    [docs]@pytest.fixture(scope="function") def make_datasets(): @@ -165,7 +163,7 @@

    Source code for crikit.data.tests.test_spectrum

    <

    Quick search

    @@ -184,14 +182,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/datasets/model.html b/docs/build/html/_modules/crikit/datasets/model.html index b57de7d..ba4a8dd 100644 --- a/docs/build/html/_modules/crikit/datasets/model.html +++ b/docs/build/html/_modules/crikit/datasets/model.html @@ -5,15 +5,13 @@ - crikit.datasets.model — CRIKit2 0.4.1 documentation - - - + crikit.datasets.model — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -59,7 +57,7 @@

    Source code for crikit.datasets.model

         _M = 300
         _N = 300
     
    -    def __init__(self, subsample=1, dtype=_np.complex):
    +    def __init__(self, subsample=1, dtype=complex):
             self.n_layers = 7  # Number of components
             self.img_shape = [300, 300]  # Spaital imaging shape
     
    @@ -108,7 +106,7 @@ 

    Source code for crikit.datasets.model

                     gd_spec = _get_data('crikit.datasets', '{}{}{}'.format(self.__spec_prefix,
                                                                         num, '.csv'))
                     self.spec_list.append(_np.genfromtxt(_BytesIO(gd_spec), delimiter=','))
    -        except:
    +        except Exception:
                 print('Failed to import model layer and/or spectral information')
             else:
                 print('Model spatial size: {}'.format(self.img_shape))
    @@ -155,7 +153,7 @@ 

    Source code for crikit.datasets.model

                     self.n_peak_list.append(a_vec.size)
     
                     self.spectra[num, :] = _np.sum(a_vec[:,None] / (omega_vec [:,None] - f[None,:] - 1j*gamma_vec[:,None]), axis=0)
    -        except:
    +        except Exception:
                 print('Failed to make model spectra')
             else:
                 print('Model spectral size: {}'.format(self.f.size))
    @@ -176,7 +174,7 @@

    Source code for crikit.datasets.model

                 # self.hsi = _np.zeros(self.img_shape + [self._f.size], dtype=self.dtype)
                 self.hsi = _np.dot(self.layers, self.spectra)
                 print('Model HSI shape: {}'.format(self.hsi.shape))
    -        except:
    +        except Exception:
                 print('Faled to make model HSI')
    #%% @@ -202,7 +200,7 @@

    Source code for crikit.datasets.model

       

    Quick search

    @@ -221,14 +219,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/csv_nist.html b/docs/build/html/_modules/crikit/io/csv_nist.html index 87e687c..023aa2c 100644 --- a/docs/build/html/_modules/crikit/io/csv_nist.html +++ b/docs/build/html/_modules/crikit/io/csv_nist.html @@ -5,15 +5,13 @@ - crikit.io.csv_nist — CRIKit2 0.4.1 documentation - - - + crikit.io.csv_nist — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -49,9 +47,9 @@

    Source code for crikit.io.csv_nist

     import numpy as _np
     import copy as _copy
     
    -from crikit.data.spectrum import Spectrum as _Spectrum
    +from crikit.data.spectra import Spectrum as _Spectrum
     from crikit.data.spectra import Spectra as _Spectra
    -from crikit.data.hsi import Hsi as _Hsi
    +from crikit.data.spectra import Hsi as _Hsi
     
     from configparser import ConfigParser as _ConfigParser
     #
    @@ -75,7 +73,7 @@ 

    Source code for crikit.io.csv_nist

         filename_data : str
             File name of data
     
    -    output_cls_instance : crikit.data.spectrum.Spectrum (or subclass)
    +    output_cls_instance : crikit.data.spectra.Spectrum (or subclass)
             Spectrum class (or sub) object
     
         Returns
    @@ -96,7 +94,7 @@ 

    Source code for crikit.io.csv_nist

         try:
             with open(pfname_header,'r') as _:
                 pass
    -    except:
    +    except Exception:
             print('Invalid header filename')
         else:
             valid_import_locs += 1
    @@ -104,7 +102,7 @@ 

    Source code for crikit.io.csv_nist

         try:
             with open(pfname_data,'r') as _:
                 pass
    -    except:
    +    except Exception:
             print('Invalid data filename')
         else:
             valid_import_locs += 1
    @@ -166,10 +164,10 @@ 

    Source code for crikit.io.csv_nist

                             try:  # int
                                 v = int(each_val)
                                 #print('Integer')
    -                        except:
    +                        except Exception:
                                 try:  # float
                                     v = float(each_val)
    -                            except:  # string
    +                            except Exception:  # string
                                     v = str.strip(each_val,'"')
                             #print('{}.{}: {}'.format(each_section,each_key, v))
                             attr.update({k:v})
    @@ -200,7 +198,7 @@ 

    Source code for crikit.io.csv_nist

                         y_steps = config.getint('Y scan Paramters','Y steps')
                         y_step_size = config.getfloat('Y scan Paramters','Y step size (um)')
                         y = _np.linspace(y_start, y_start + y_step_size * (y_steps-1), y_steps)
    -                except:  # In case typo is corrected in the future
    +                except Exception:  # In case typo is corrected in the future
                         y_start = config.getfloat('Y scan Parameters','Y start (um)')
                         y_steps = config.getint('Y scan Parameters','Y steps')
                         y_step_size = config.getfloat('Y scan Parameters','Y step size (um)')
    @@ -215,10 +213,10 @@ 

    Source code for crikit.io.csv_nist

                             try:  # int
                                 v = int(each_val)
                                 #print('Integer')
    -                        except:
    +                        except Exception:
                                 try:  # float
                                     v = float(each_val)
    -                            except:  # string
    +                            except Exception:  # string
                                     v = str.strip(each_val,'"')
                             #print('{}.{}: {}'.format(each_section,each_key, v))
                             attr.update({k:v})
    @@ -271,14 +269,14 @@ 

    Source code for crikit.io.csv_nist

                             
                         # Figure out fixed positions later
                         
    -                except:
    +                except Exception:
                         pass
                     else:
                         output_cls_instance.data = data
                         output_cls_instance.meta = attr
                         return True
     
    -        except:
    +        except Exception:
                 print('Something failed in import')
    if __name__ == '__main__': @@ -305,7 +303,7 @@

    Source code for crikit.io.csv_nist

       

    Quick search

    @@ -324,14 +322,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/hdf5.html b/docs/build/html/_modules/crikit/io/hdf5.html index 2c51747..4e009fb 100644 --- a/docs/build/html/_modules/crikit/io/hdf5.html +++ b/docs/build/html/_modules/crikit/io/hdf5.html @@ -5,15 +5,13 @@ - crikit.io.hdf5 — CRIKit2 0.4.1 documentation - - - + crikit.io.hdf5 — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -47,17 +45,120 @@

    Source code for crikit.io.hdf5

     @author: chc
     """
     
    -import os as _os
    +import numpy as np
     
    -import numpy as _np
    +from crikit.data.spectra import Spectrum
    +from crikit.data.spectra import Spectra
    +from crikit.data.spectra import Hsi
     
    -from crikit.data.spectrum import Spectrum as _Spectrum
    -from crikit.data.spectra import Spectra as _Spectra
    -from crikit.data.hsi import Hsi as _Hsi
    +import crikit.io.lazy5 as lazy5
    +from crikit.utils.general import find_nearest
    +from scipy.interpolate import interp1d
     
    -import lazy5 as _lazy5
     
    -__all__ = ['hdf_import_data']
    +__all__ = ['hdf_import_data', 'hdf_import_data_macroraster']
    +
    +
    +
    [docs]def hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance, config_dict=None): + """ + Import dataset(s) from HDF file with each dset being a single line scan. + + Parameters + ---------- + pth : str + Path + + filename : str + File name + + dset_list : list + List of 1 or more datasets + + output_cls_instance : crikit.data.spectra.Spectrum (or subclass) + Spectrum class (or sub) object + + Returns + ------- + Success : bool + Success of import + Data, Meta : list (ndarray, dict) + If output_cls_instance is None and import is successful, will \ + return the data from dset_list and associated meta data. + + """ + + config_dict_template = {'fast_start': 'Macro.Raster.Fast.Start', + 'fast_stop': 'Macro.Raster.Fast.Stop', + 'fast_steps': 'Macro.Raster.Fast.Steps', + 'fast_pos_sampled': 'MicroStage.raster.fast.pos_sample_vec', + 'n_imgs_at_sampled': 'MicroStage.raster.fast.n_images_at_pos_samples', + 'slow_start': 'Macro.Raster.Slow.Start', + 'slow_stop': 'Macro.Raster.Slow.Stop', + 'slow_steps': 'Macro.Raster.Slow.Steps', + 'slow_current_pos': 'MicroStage.raster.slow.pos', + 'n_pix': 'Spectrometer.calib.n_pix'} + config = {} + config.update(config_dict_template) + if config_dict is not None: + config.update(config_dict) + + # Join path and filename in an os-independant way + pfname = lazy5.utils.fullpath(filename, pth=pth) + + if not lazy5.inspect.valid_file(filename, pth=pth, verbose=True): + return False + elif not lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=False): + return False + else: + fof = lazy5.utils.FidOrFile(pfname, mode='r') + fid = fof.fid + + assert isinstance(output_cls_instance, Hsi) + assert isinstance(dset_list, list) + + all_xs = [] + all_ys = [] + + for num, dname in enumerate(dset_list): + # Convert to hardware-oriented dtype (endianess) + # dset_dtype_import = fid[dname].dtype.newbyteorder('=') + # dset_shp = fid[dname].shape + + curr_slice = fid[dname][:] + meta = lazy5.inspect.get_attrs_dset(fid, dname) + if num == 0: + dset_dtype_import = fid[dname].dtype.newbyteorder('=') + dset_shp = (meta[config['slow_steps']], meta[config['fast_steps']], + meta[config['n_pix']]) + output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import) + + x_vec = np.linspace(meta[config['fast_start']], meta[config['fast_stop']], + meta[config['fast_steps']]) + y_vec = np.linspace(meta[config['slow_start']], meta[config['slow_stop']], + meta[config['slow_steps']]) + + curr_y_pos = meta[config['slow_current_pos']] + + curr_x_vec = meta[config['fast_pos_sampled']] + curr_n_imgs_vec = meta[config['n_imgs_at_sampled']] + + all_xs.extend(curr_x_vec.tolist()) + all_ys.extend([curr_y_pos]) + + intfcn = interp1d(curr_n_imgs_vec, curr_x_vec, kind='linear') + + int_fcn_intensity = interp1d(intfcn(np.arange(curr_slice.shape[0])), + curr_slice, axis=0, bounds_error=False, kind='linear', fill_value='extrapolate') + + y_idx = find_nearest(y_vec, curr_y_pos)[1] + output_cls_instance.data[y_idx, ...] = int_fcn_intensity(x_vec) + + # extent = [x_vec.min(), x_vec.max(), y_vec.min(), y_vec.max()] + + fid.close() + output_cls_instance.meta = meta + return True
    +
    [docs]def hdf_import_data(pth, filename, dset_list, output_cls_instance=None): """ @@ -74,7 +175,7 @@

    Source code for crikit.io.hdf5

         dset_list : list
             List of 1 or more datasets
     
    -    output_cls_instance : crikit.data.spectrum.Spectrum (or subclass)
    +    output_cls_instance : crikit.data.spectra.Spectrum (or subclass)
             Spectrum class (or sub) object
     
         Returns
    @@ -87,27 +188,27 @@ 

    Source code for crikit.io.hdf5

     
         """
         # Join path and filename in an os-independant way
    -    pfname = _lazy5.utils.fullpath(filename, pth=pth)
    +    pfname = lazy5.utils.fullpath(filename, pth=pth)
     
    -    if not _lazy5.inspect.valid_file(filename, pth=pth, verbose=True):
    +    if not lazy5.inspect.valid_file(filename, pth=pth, verbose=True):
             return False
    -    elif not _lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=True):
    +    elif not lazy5.inspect.valid_dsets(filename, dset_list, pth=pth, verbose=True):
             return False
         else:
    -        fof = _lazy5.utils.FidOrFile(pfname, mode='r')
    +        fof = lazy5.utils.FidOrFile(pfname, mode='r')
             fid = fof.fid
     
    -        if type(output_cls_instance) == _Hsi:
    +        if type(output_cls_instance) == Hsi:
                 print('Type Hsi')
                 if isinstance(dset_list, str):
                     # Convert to hardware-oriented dtype (endianess)
                     dset_dtype_import = fid[dset_list].dtype.newbyteorder('=')
                     dset_shp = fid[dset_list].shape
    -                output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import)
    +                output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import)
                     fid[dset_list].read_direct(output_cls_instance.data)
     
                     # output_cls_instance.data = fid[dset_list].value
    -                output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list)
    +                output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list)
                 elif isinstance(dset_list, list):
                     if len(dset_list) > 1:
                         print('Cannot accept more than 1 HSI image at this time')
    @@ -117,30 +218,28 @@ 

    Source code for crikit.io.hdf5

                             dset_dtype_import = fid[dname].dtype.newbyteorder('=')
                             dset_shp = fid[dname].shape
                             if num == 0:
    -                            output_cls_instance.data = _np.zeros(dset_shp,
    -                                                                    dtype=dset_dtype_import)
    +                            output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import)
                                 fid[dname].read_direct(output_cls_instance.data)
     
                                 # output_cls_instance.data = fid[dname][:]
    -                            output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname)
    +                            output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname)
                             else:
    -                            output_cls_instance.data = _np.vstack((output_cls_instance.data,
    -                                                                    fid[dname][:].astype(dset_dtype_import)))
    +                            output_cls_instance.data = np.vstack((output_cls_instance.data, fid[dname][:].astype(dset_dtype_import)))
                 ret = True
    -        elif type(output_cls_instance) == _Spectra:
    +        elif type(output_cls_instance) == Spectra:
                 print('Type Spectra')
                 if isinstance(dset_list, str):
                     # Convert to hardware-oriented dtype (endianess)
                     dset_dtype_import = fid[dset_list].dtype.newbyteorder('=')
                     if fid[dset_list].ndim == 2:  # Compatible dimensions-- use read-direct
                         dset_shp = fid[dset_list].shape
    -                    output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import)
    +                    output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import)
                         fid[dset_list].read_direct(output_cls_instance.data)
                     else:
                         output_cls_instance.data = fid[dset_list].value.astype(dset_dtype_import)
     
                     # output_cls_instance.data = fid[dset_list].value
    -                output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list)
    +                output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list)
     
                 elif isinstance(dset_list, list):
                     for num, dname in enumerate(dset_list):
    @@ -148,22 +247,21 @@ 

    Source code for crikit.io.hdf5

                         dset_dtype_import = fid[dname].dtype.newbyteorder('=')
                         if num == 0:
                             output_cls_instance.data = fid[dname][:].astype(dset_dtype_import)
    -                        output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname)
    +                        output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname)
                         else:
    -                        output_cls_instance.data = _np.vstack((output_cls_instance.data,
    -                                                               fid[dname][:].astype(dset_dtype_import)))
    +                        output_cls_instance.data = np.vstack((output_cls_instance.data, fid[dname][:].astype(dset_dtype_import)))
                 ret = True
    -        elif type(output_cls_instance) == _Spectrum:
    +        elif type(output_cls_instance) == Spectrum:
                 print('Type Spectrum')
                 if isinstance(dset_list, str):
                     # Convert to hardware-oriented dtype (endianess)
                     dset_dtype_import = fid[dset_list].dtype.newbyteorder('=')
                     dset_shp = fid[dset_list].shape
    -                output_cls_instance.data = _np.zeros(dset_shp, dtype=dset_dtype_import)
    +                output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import)
                     fid[dset_list].read_direct(output_cls_instance.data)
     
                     # output_cls_instance.data = fid[dset_list].value
    -                output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dset_list)
    +                output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list)
                 elif isinstance(dset_list, list):
                     if len > 1:
                         print('Will average spectra into a single spectrum')
    @@ -173,46 +271,44 @@ 

    Source code for crikit.io.hdf5

                             dset_dtype_import = fid[dname].dtype.newbyteorder('=')
                             dset_shp = fid[dname].shape
                             if num == 0:
    -                            output_cls_instance.data = _np.zeros(dset_shp,
    -                                                                    dtype=dset_dtype_import)
    +                            output_cls_instance.data = np.zeros(dset_shp, dtype=dset_dtype_import)
                                 fid[dname].read_direct(output_cls_instance.data)
                                 # output_cls_instance.data = fid[dname][:]
    -                            output_cls_instance.meta = _lazy5.inspect.get_attrs_dset(fid, dname)
    +                            output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dname)
                             else:
                                 output_cls_instance.data += fid[dname][:].astype(dset_dtype_import)
    -                    output_cls_instance.data /= num+1
    +                    output_cls_instance.data /= num + 1
                 ret = True
             elif output_cls_instance is None:
                 if isinstance(dset_list, str):
                     # Convert to hardware-oriented dtype (endianess)
                     dset_dtype_import = fid[dset_list].dtype.newbyteorder('=')
                     dset_shp = fid[dset_list].shape
    -                data = _np.zeros(dset_shp, dtype=dset_dtype_import)
    +                data = np.zeros(dset_shp, dtype=dset_dtype_import)
                     fid[dset_list].read_direct(data)
     
                     # data = fid[dset_list].value
    -                meta = _lazy5.inspect.get_attrs_dset(fid, dset_list)
    +                meta = lazy5.inspect.get_attrs_dset(fid, dset_list)
                 elif isinstance(dset_list, list):
                     for num, dname in enumerate(dset_list):
                         # Convert to hardware-oriented dtype (endianess)
                         dset_dtype_import = fid[dname].dtype.newbyteorder('=')
                         dset_shp = fid[dname].shape
                         if num == 0:
    -                        data = _np.zeros(dset_shp,
    -                                                                dtype=dset_dtype_import)
    +                        data = np.zeros(dset_shp, dtype=dset_dtype_import)
                             fid[dname].read_direct(data)
                             # data = fid[dname][:]
    -                        meta = _lazy5.inspect.get_attrs_dset(fid, dname)
    +                        meta = lazy5.inspect.get_attrs_dset(fid, dname)
                         else:
    -                        data = _np.vstack((data, fid[dname][:].astype(dset_dtype_import)))
    +                        data = np.vstack((data, fid[dname][:].astype(dset_dtype_import)))
                 ret = [data, meta]
             else:
                 raise TypeError('output_cls must be Spectrum, Spectra, or Hsi')
     
    -
             fid.close()
             return ret
    + if __name__ == '__main__': # pragma: no cover from crikit.io.meta_configs import (special_nist_bcars2 as _snb) @@ -221,35 +317,34 @@

    Source code for crikit.io.hdf5

         pth = '../'
         filename = 'mP2_w_small.h5'
     
    -
         dset = '/Spectra/Dark_3_5ms_2'
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake')
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake')
         assert not tester
     
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake_dset')
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5', dset_list='fake_dset')
         assert not tester
     
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file='fake.h5',
    -                                        dset_list=['fake_dset1', 'fake_dset2'])
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file='fake.h5',
    +                                       dset_list=['fake_dset1', 'fake_dset2'])
         assert not tester
     
         print('Path: {}'.format(pth))
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename, dset_list=dset, verbose=True)
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file=filename, dset_list=dset, verbose=True)
         assert tester
     
         print('--------------\n\n')
     
    -    spect_dark = _Spectra()
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename,
    -                                        dset_list=['/Spectra/Dark_3_5ms_2'])
    +    spect_dark = Spectra()
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file=filename,
    +                                       dset_list=['/Spectra/Dark_3_5ms_2'])
         hdf_import_data(pth, filename, '/Spectra/Dark_3_5ms_2', spect_dark)
    -    #hdf_process_attr(rosetta, spect_dark)
    +    # hdf_process_attr(rosetta, spect_dark)
     
         print('Shape of dark spectra: {}'.format(spect_dark.shape))
         print('Shape of dark spectra.mean(): {}'.format(spect_dark.mean().shape))
         print('Dtype of dark spectra: {}'.format(spect_dark._data.dtype))
         print('')
    -    img = _Hsi()
    +    img = Hsi()
         hdf_import_data(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img)
         print('Shape of img: {}'.format(img.shape))
         print('Shape of img.mean(): {}'.format(img.mean().shape))
    @@ -261,9 +356,9 @@ 

    Source code for crikit.io.hdf5

         pth = 'C:/Users/chc/Documents/Data/2018/OliverJonas/180629/'
         filename = 'L1d1_pos0.h5'
         dsetname = '/BCARSImage/L1d1_pos0_0/NRB_Post_0'
    -    spect_nrb = _Spectra()
    -    tester = _lazy5.inspect.valid_dsets(pth=pth, file=filename,
    -                                        dset_list=[dsetname])
    +    spect_nrb = Spectra()
    +    tester = lazy5.inspect.valid_dsets(pth=pth, file=filename,
    +                                       dset_list=[dsetname])
         out = hdf_import_data(pth, filename, dsetname, spect_nrb)
         print('HDF_import_data returned: {}'.format(out))
         # hdf_process_attr(rosetta, spect_nrb)
    @@ -272,7 +367,7 @@ 

    Source code for crikit.io.hdf5

         # print('Shape of dark spectra.mean(): {}'.format(spect_dark.mean().shape))
         # print('Dtype of dark spectra: {}'.format(spect_dark._data.dtype))
         # print('')
    -    # img = _Hsi()
    +    # img = Hsi()
         # hdf_import_data(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img)
         # print('Shape of img: {}'.format(img.shape))
         # print('Shape of img.mean(): {}'.format(img.mean().shape))
    @@ -290,7 +385,7 @@ 

    Source code for crikit.io.hdf5

       

    Quick search

    @@ -309,14 +404,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/alter.html b/docs/build/html/_modules/crikit/io/lazy5/alter.html new file mode 100644 index 0000000..5ef87de --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/alter.html @@ -0,0 +1,239 @@ + + + + + + + + crikit.io.lazy5.alter — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.alter

    +""" Macros for inspection of HDF5 files """
    +import h5py as _h5py
    +
    +from .utils import (FidOrFile as _FidOrFile, fullpath as _fullpath)
    +from .nonh5utils import (check_type_compat as _check_type_compat)
    +
    +from .config import DefaultConfig
    +_h5py.get_config().complex_names = DefaultConfig().complex_names
    +
    +
    [docs]def alter_attr(dset, attr_key, attr_val, file=None, pth=None, verbose=False, + check_same_type=False, must_exist=False): + """ + Alter attribute dset['attr_key'] with attr_val. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + file/fid must be provided. + + attr_key : str + Attribute name (key) + + attr_val : str + Attribute value to write (replace old) + + file : str or h5py.File + Filename or File-object for open HDF5 file + + pth : str + Path + + verbose : bool + Verbose output to stdout + + check_same_type : bool + Check that the inputs are compatible types as defined in + lazy5.nonh5utils.check_type_compat or lazy5.utils.return_family_type + + must_exist : bool + The attribute must already exist. + + Notes + ----- + None + """ + + if file is not None: + fp = _fullpath(file, pth) + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp, mode='r+') # Read/write, file must exist + fid = fof.fid + if isinstance(dset, str): + dset_object = fid[dset] + elif isinstance(dset, _h5py.Dataset): + if isinstance(file, str): + raise TypeError('Cannot provide h5py.Dataset dset and a filename str.') + dset_object = dset + else: + raise TypeError('dset unknown') + else: + fof = None + if isinstance(dset, _h5py.Dataset): + dset_object = dset + else: + raise TypeError('With no file or fid given, dset must be an h5py.Dataset object') + + if must_exist: + if dset_object.attrs.get(attr_key) is None: + err_str1 = 'Attribute {} does not exist and '.format(attr_key) + raise KeyError(err_str1 + 'must_exist set to True') + + if check_same_type & (dset_object.attrs.get(attr_key) is not None): + if not _check_type_compat(dset_object.attrs[attr_key], attr_val): + err_str1 = 'New attribute value type ({}) '.format(type(attr_val)) + err_str2 = 'must be of the same type as the original ' + err_str3 = '({})'.format(type(dset_object.attrs[attr_key])) + raise TypeError(err_str1 + err_str2 + err_str3) + + if verbose: + if dset_object.attrs.get(attr_key) is None: + print('Attribute {} does not exist. Creating.'.format(attr_key)) + else: + print('Dataset[{}] = {} -> {}'.format(attr_key, dset_object.attrs[attr_key], + attr_val)) + + dset_object.attrs[attr_key] = attr_val + + if fof is not None: + fof.close_if_file_not_fid()
    + +
    [docs]def alter_attr_same(dset, attr_key, attr_val, file=None, pth=None, verbose=True, + must_exist=False): + """ + Alter attribute dset['attr_key] with attr_val checkint to make sure that + the original and new attribute values are of similar type e.g., int and + np.int32. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + file/fid must be provided. + + attr_key : str + Attribute name (key) + + attr_val : str + Attribute value to write (replace old) + + file : str or h5py.File + Filename or File-object for open HDF5 file + + pth : str + Path + + verbose : bool + Verbose output to stdout + + Notes + ----- + None + """ + return alter_attr(dset, attr_key, attr_val, file, pth, verbose, + check_same_type=True, must_exist=must_exist)
    + +
    [docs]def write_attr_dict(dset, attr_dict, fid=None, sort_attrs=False, verbose=False): + """ + Write entire dictionary of attrbutes to dataset. + + Parameters + ---------- + dset : str or h5py.Dataset + String to or Dataset-object for dataset in HDF5 file. If string, + fid must be provided. + + attr_dict : dict + Attribute dictionary + + fid : h5py.File + If dset is a string, file-object for open HDF5 file must be provided. + + sort_attrs : bool + Sort attribute keys alphabetically prior to writing + + verbose : bool + Verbose output to stdout + """ + + attr_key_list = list(attr_dict) + if sort_attrs: + attr_key_list.sort() + + for attr_key in attr_key_list: + attr_val = attr_dict[attr_key] + alter_attr(dset, attr_key, attr_val, file=fid, verbose=verbose, + check_same_type=False, must_exist=False) + + return True
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/config.html b/docs/build/html/_modules/crikit/io/lazy5/config.html new file mode 100644 index 0000000..a03a3d5 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/config.html @@ -0,0 +1,85 @@ + + + + + + + + crikit.io.lazy5.config — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.config

    +""" Default configuration class """
    +
    +
    [docs]class DefaultConfig: + def __init__(self): + self.complex_names = ('Re', 'Im')
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/create.html b/docs/build/html/_modules/crikit/io/lazy5/create.html new file mode 100644 index 0000000..82b351a --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/create.html @@ -0,0 +1,161 @@ + + + + + + + + crikit.io.lazy5.create — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.create

    +""" Macros for creation of HDF5 files and/or datasets"""
    +import h5py as _h5py
    +
    +from .config import DefaultConfig
    +from .utils import (FidOrFile as _FidOrFile, fullpath as _fullpath)
    +from .inspect import (valid_dsets as _valid_dsets)
    +from .alter import (write_attr_dict as _write_attr_dict)
    +
    +_h5py.get_config().complex_names = DefaultConfig().complex_names
    +
    +
    [docs]def save(file, dset, data, pth=None, attr_dict=None, mode='a', + dset_overwrite=False, sort_attrs=False, + chunks=True, verbose=False): + """ + Save an HDF5 file + + Parameters + ---------- + + file : str or h5py.File object (fid) + Filename + + dset : str + Dataset name (including groups if any) + + data : ndarray + Data to write + + pth : str + Path to file. Otherwise, will use present working directory (PWD) + + attr_dict : dict + Attribute dictionary. Will be Ordered. + + mode : str + h5py file mode. + + dset_overwrite : bool + If a dset already exists, overwrite or raise error? + + sort_attrs : bool + Sort the attribute dictionary (alphabetically) prior to saving + + chunks : str or tuple or list + Chunking shape or True for auto-chunking + + verbose : bool + Verbose output + + Returns + ------- + + bool : Saved with no errors + + """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + fof = _FidOrFile(fp, mode=mode) + elif isinstance(file, _h5py.File): + fof = _FidOrFile(file, mode=mode) + else: + raise TypeError('file needs to be a str or h5py.File object.') + + fid = fof.fid + + if not dset_overwrite: + if _valid_dsets(fid, dset, pth=pth, verbose=False): + err_str1 = 'Dataset {} exists. '.format(dset) + err_str2 = 'Param dset_overwrite=False. Will not overwrite' + raise IOError(err_str1 + err_str2) + + dset_id = fid.require_dataset(name=dset, data=data, shape=data.shape, + dtype=data.dtype, chunks=chunks) + + if attr_dict: + _write_attr_dict(dset_id, attr_dict, sort_attrs=sort_attrs) + + fof.close_if_file_not_fid() + + return True
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/inspect.html b/docs/build/html/_modules/crikit/io/lazy5/inspect.html new file mode 100644 index 0000000..ce08c6e --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/inspect.html @@ -0,0 +1,368 @@ + + + + + + + + crikit.io.lazy5.inspect — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.inspect

    +""" Macros for inspection of HDF5 files """
    +import os as _os
    +from collections import OrderedDict as _OrderedDict
    +
    +import h5py as _h5py
    +import numpy as _np
    +
    +from .utils import (FidOrFile as _FidOrFile, hdf_is_open as _hdf_is_open,
    +                    fullpath as _fullpath)
    +
    +from .config import DefaultConfig
    +_h5py.get_config().complex_names = DefaultConfig().complex_names
    +
    +__all__ = ['get_groups', 'get_datasets', 'get_hierarchy',
    +           'get_attrs_dset', 'valid_dsets', 'valid_file']
    +
    +
    [docs]def get_groups(file, pth=None): + """ + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + Notes + ----- + Gets groups in a hierarchical list starting from the base '/'. Thus if + Group2 is INSIDE Group1, it will return Group1, Group1/Group2 -- NOT Group2 + inidividually. + """ + + fp = _fullpath(file, pth) + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + all_items_list = [] + fid.visit(lambda x: all_items_list.append('/{}'.format(x))) + + # list-set-list removes duplicates + grp_list = list(set([item for item in all_items_list if isinstance(fid[item], _h5py.Group)])) + + grp_list.append('/') # Add in base level group + grp_list.sort() + + fof.close_if_file_not_fid() + + return grp_list
    + +
    [docs]def get_datasets(file, pth=None, fulldsetpath=True): + """ + Parameters + ---------- + + file : str or _h5py.File + Filename or File-object for open HDF5 file + + fulldsetpath : bool + Return just the dataset names with group names or not. + """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + fof = _FidOrFile(fp) + + else: + fof = _FidOrFile(file) + + fid = fof.fid + + all_items_list = [] + fid.visit(lambda x: all_items_list.append('/{}'.format(x))) + dset_list = [] + + # list-set-list removes duplicates + dset_list = list(set([item for item in all_items_list if isinstance(fid[item], _h5py.Dataset)])) + dset_list.sort() + + if not fulldsetpath: + for num, dset in enumerate(dset_list): + split_out = dset.rsplit('/', maxsplit=1) + if len(split_out) == 1: + pass + else: + dset_list[num] = split_out[-1] + + fof.close_if_file_not_fid() + + return dset_list
    + +
    [docs]def get_hierarchy(file, pth=None, fulldsetpath=False, grp_w_dset=False): + """ + Return an ordered dictionary, where the keys are groups and the items are + the datasets + + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + fulldsetpath : bool + If True, a dataset name will be prepended with the group down to the + base level, '/'. If False, it will just be the dset name. + + grp_w_dset : bool + If True, only return groups that contain datasets. If False, include + empty groups + + Returns + ------- + OrderedDict : (group, [dataset list]) + Group and dataset names + + """ + fp = _fullpath(file, pth) + + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + grp_list = get_groups(fid) + dset_list = get_datasets(fid, fulldsetpath=True) + + grp_dict = _OrderedDict([[grp, []] for grp in grp_list]) + + for dset in dset_list: + split_out = dset.rsplit('/', maxsplit=1) + if (len(split_out) == 1) or (split_out[0] == ''): + if dset[0] == '/': + grp_dict['/'].append(dset[1:]) + else: + grp_dict['/'].append(dset) + else: + if fulldsetpath: + grp_dict[split_out[0]].append(dset) + else: + grp_dict[split_out[0]].append(split_out[1]) + + # Only keep groups with datasets + if grp_w_dset: + to_pop = [] + for k in grp_dict: + if not grp_dict[k]: # is empty + to_pop.append(k) + + for empty_grp in to_pop: + grp_dict.pop(empty_grp) + + fof.close_if_file_not_fid() + + return grp_dict
    + +
    [docs]def get_attrs_dset(file, dset, pth=None, convert_to_str=True, convert_sgl_np_to_num=False): + """ + Get dictionary of attribute values for a given dataset + + Parameters + ---------- + + file : str or h5py.File + Filename or File-object for open HDF5 file + + dset : str + Full dataset name with preprended group names. E.g., '/Group1/Dataset' + + convert_to_str : bool + If an attribute is a numpy.bytes_ string-like object, but not a str, try + to decode into utf-8. + + convert_sgl_np_to_num : bool + If an attribute is a numpy array with a single entry, convert to non-numpy + numeric type. E.g. np.array([1.0]) -> 1.0 + + Returns + ------- + OrderedDict : (key, value) + + """ + fp = _fullpath(file, pth) + + # Get fid for a file (str or open fid) + fof = _FidOrFile(fp) + fid = fof.fid + + ds_attrs = fid[dset].attrs + + attr_keys_list = list(ds_attrs) + attr_keys_list.sort() + + attr_list = [] + for k in attr_keys_list: + try: + attr_val = ds_attrs[k] + except (TypeError, ValueError): + print('Could not get value for attribute: {}. Set to None'.format(k)) + attr_list.append([k, None]) + else: + if isinstance(attr_val, _np.ndarray): + if (isinstance(attr_val, _np.bytes_) | (attr_val.dtype.type == _np.bytes_)) & convert_to_str: # pylint: disable=no-member + # * tostring() added in \x00 to end of string; thus, used list comprehension + np_byte_to_str = [q for q in attr_val][0].decode() + attr_list.append([k, np_byte_to_str]) + elif (_np.issubdtype(attr_val.dtype, _np.number) & (attr_val.size == 1)) & convert_sgl_np_to_num: + attr_list.append([k, attr_val.item()]) + else: + attr_list.append([k, attr_val]) + elif isinstance(attr_val, bytes) & convert_to_str: + attr_list.append([k, attr_val.decode()]) + else: + attr_list.append([k, attr_val]) + + attr_dict = _OrderedDict(attr_list) + + fof.close_if_file_not_fid() + + return attr_dict
    + +
    [docs]def valid_file(file, pth=None, verbose=False): + """ Validate whether a file exists (or if a fid, is-open """ + + if isinstance(file, str): + fp = _fullpath(file, pth) + isvalid = _os.path.isfile(fp) + + if verbose: + if isvalid: + print('{} is a valid file.'.format(fp)) + else: + print('{} is a not valid file.'.format(fp)) + + elif isinstance(file, _h5py.File): + isvalid = _hdf_is_open(file) + else: + raise TypeError('file need be of type str or h5py.File object.') + + return isvalid
    + +
    [docs]def valid_dsets(file, dset_list, pth=None, verbose=False): + """ Check whether 1 or more datasets are valid """ + + def _add_leading_slash(str_to_check): + """ Return string sans leading '/' if there is one """ + if str_to_check[0] == '/': + return str_to_check + else: + return '/' + str_to_check + + file_is_valid = valid_file(file, pth=pth, verbose=verbose) + + if not file_is_valid: + return False + + dset_in_file = get_datasets(file, pth=pth, fulldsetpath=True) + + if isinstance(dset_list, (list, tuple)): + hits = 0 + for dset in dset_list: + dset_to_test = _add_leading_slash(dset) + if dset_in_file.count(dset_to_test) > 0: + hits += 1 + if verbose: + print('{} : VALID'.format(dset_to_test)) + else: + if verbose: + print('{} : NOT VALID'.format(dset_to_test)) + if hits == len(dset_list): + if verbose: + print('All datasets are valid') + return True + else: + if verbose: + print('Some or all datasets are NOT valid') + return False + elif isinstance(dset_list, str): + if dset_in_file.count(_add_leading_slash(dset_list)) > 0: + if verbose: + print('{} : VALID'.format(dset_list)) + return True + else: + if verbose: + print('{} : NOT VALID'.format(dset_list)) + return False + else: + err_str1 = 'dset_list: {} of type {} '.format(dset_list, type(dset_list)) + err_str2 = 'is not a str, list, or tuple' + raise TypeError(err_str1 + err_str2)
    + +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/nonh5utils.html b/docs/build/html/_modules/crikit/io/lazy5/nonh5utils.html new file mode 100644 index 0000000..224272b --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/nonh5utils.html @@ -0,0 +1,177 @@ + + + + + + + + crikit.io.lazy5.nonh5utils — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.nonh5utils

    +""" Non-HDF5 utility functions """
    +import copy as _copy
    +from collections import OrderedDict as _OrderedDict
    +
    +import numpy as _np
    +
    +__all__ = ['filterlist', 'check_type_compat', 'return_family_type']
    +
    +
    [docs]def filterlist(in_list, filters, keep_filtered_items=True, exclusive=True): + """ + Parameters + ---------- + in_list : list + List of strings to filter + + filters : str, list, tuple + Find filters (or entries of filters) in in_list + + keep_filtered_items : bool + Returns entries from in_list that DO have filters (INCLUDE filter). + If False, EXCLUDE filter + + exclusive : bool + Filter is exclusive, i.e. includes/excludes in_list entries that + have ALL filters. Otherwise, non-exclusive and any entry with A + filter are excluded/included. + + Returns + ------- + list : filtered list + + """ + if isinstance(filters, (tuple, list)): + filter_list = filters + elif isinstance(filters, str): + filter_list = [filters] + else: + raise TypeError('filters must be of type str, tuple, or list') + + def condition(keep_it, item): + """ Keep or don't keep item depending on keep_it bool """ + if keep_it: + return item + else: + return not item + + if exclusive: + out_list = _copy.deepcopy(in_list) + for current_filt in filter_list: + out_list = [entry for entry in out_list if condition(keep_filtered_items, + entry.count(current_filt))] + else: + out_list = [] + for current_filt in filter_list: + out_list.extend([entry for entry in in_list if condition(keep_filtered_items, + entry.count(current_filt))]) + # Removes duplicates + out_list = list(_OrderedDict.fromkeys(out_list)) + + return out_list
    + +
    [docs]def check_type_compat(input_a, input_b): + """ + Check the compatibility of types. E.g. np.float32 IS compatible with + float + """ + return return_family_type(input_a) is return_family_type(input_b)
    + +
    [docs]def return_family_type(input_a): + """ Return family of type input_a. int, float, complex, str, bytes, bool """ + a_type = None + + # Have to do numpy first, bc np.str_ is subtype of str also + if isinstance(input_a, _np.generic): # Is input_a numpy-type + if isinstance(input_a, _np.bool_): + a_type = bool + elif isinstance(input_a, _np.bytes_): # pylint: disable=E1101 + a_type = bytes + elif isinstance(input_a, _np.str_): # pylint: disable=E1101 + a_type = str + elif isinstance(input_a, _np.integer): + a_type = int + elif isinstance(input_a, _np.floating): # pylint: disable=E1101 + a_type = float + elif isinstance(input_a, _np.complexfloating): # pylint: disable=E1101 + a_type = complex + elif isinstance(input_a, _np.ndarray): + # Cute trick: Send 1 as type from the dtype for testing + a_type = return_family_type(input_a.dtype.type(1)) + elif isinstance(input_a, (int, float, complex, str, bytes, bool)): + a_type = type(input_a) + + if a_type is None: + err_str1 = 'input_a is not int, float, str, or bool; ' + raise TypeError(err_str1 + 'or a numpy-equivalent: {}'.format(type(input_a))) + + return a_type
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_alter.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_alter.html new file mode 100644 index 0000000..41ebe95 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_alter.html @@ -0,0 +1,427 @@ + + + + + + + + crikit.io.lazy5.tests.test_alter — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_alter

    +""" Test inspection of HDF5 files """
    +import os
    +import time
    +
    +from collections import OrderedDict as _OrderedDict
    +
    +import h5py
    +import pytest
    +
    +import numpy as np
    +
    +from crikit.io.lazy5.utils import hdf_is_open
    +from crikit.io.lazy5.alter import alter_attr_same, alter_attr, write_attr_dict
    +
    +
    [docs]@pytest.fixture(scope="function") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename))
    + + +
    [docs]def test_attr_alter_same(hdf_dataset): + """ Try altering an attribute with the same type of value type """ + + _, fid = hdf_dataset + dset_obj = fid['base'] + attr_obj = dset_obj.attrs + + # Try new attrbute + orig_key = 'Attribute_new' + new_val = 'Test2' + alter_attr_same(dset_obj, orig_key, new_val) + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_new2' + new_val = 'Test2' + with pytest.raises(KeyError): + alter_attr_same(dset_obj, orig_key, new_val, must_exist=True) + + # Try same-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = b'Test2' + # alter_attr_same(dset_obj, orig_key, new_val) + # assert orig_val != attr_obj[orig_key] + # assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = np.bytes_('Test2') # pylint: disable=E1101 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2.2 + alter_attr_same(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4, 5, 6]) + alter_attr_same(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8, 9], [10, 11, 12]]) + alter_attr_same(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try DIFFERENT-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 1 + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = 'Test2' + # with pytest.raises(TypeError): + # alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = True + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2 + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4.1, 5.1, 6.1]) + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8.1, 9], [10, 11, 12.1]]) + with pytest.raises(TypeError): + alter_attr_same(dset_obj, orig_key, new_val)
    + + +
    [docs]def test_attr_alter(hdf_dataset): + """ Try altering an attribute with the same or different type of value""" + + filename, fid = hdf_dataset + dset_obj = fid['base'] + attr_obj = dset_obj.attrs + + # Try new attrbute (dset_obj) + orig_key = 'Attribute_new' + new_val = 'Test2' + assert attr_obj.get(orig_key) is None + alter_attr(dset_obj, orig_key, new_val) + assert attr_obj[orig_key] == new_val + + # Try new attrbute (dset_obj) + orig_key = 'Attribute_new2' + new_val = 'Test2' + assert attr_obj.get(orig_key) is None + with pytest.raises(TypeError): + alter_attr([], orig_key, new_val, file=fid) + alter_attr(dset_obj, orig_key, new_val, file=fid) + assert attr_obj[orig_key] == new_val + + # Try new attrbute (given filename) + orig_key = 'Attribute_new3' + new_val = 'Test3' + with pytest.raises(TypeError): + alter_attr(dset_obj, orig_key, new_val, file=filename) + alter_attr('base', orig_key, new_val, file=filename) + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_new4' + new_val = 'Test2' + with pytest.raises(KeyError): + alter_attr(dset_obj, orig_key, new_val, must_exist=True) + + # Try same-type writes + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # orig_key = 'Attribute_bytes' + # orig_val = attr_obj[orig_key] + # new_val = b'Test2' + # alter_attr(dset_obj, orig_key, new_val) + # assert orig_val != attr_obj[orig_key] + # assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = np.bytes_('Test2') # pylint: disable=E1101 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2.2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4, 5, 6]) + alter_attr(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8, 9], [10, 11, 12]]) + alter_attr(dset_obj, orig_key, new_val) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try DIFFERENT-type writes first + orig_key = 'Attribute_str' + orig_val = attr_obj[orig_key] + new_val = 1 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_bytes' + orig_val = attr_obj[orig_key] + new_val = 'Test2' + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_int' + orig_val = attr_obj[orig_key] + new_val = True + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_float' + orig_val = attr_obj[orig_key] + new_val = 2 + alter_attr(dset_obj, orig_key, new_val) + assert orig_val != attr_obj[orig_key] + assert attr_obj[orig_key] == new_val + + orig_key = 'Attribute_np_1d' + orig_val = attr_obj[orig_key] + new_val = np.array([4.1, 5.1, 6.1]) + alter_attr(dset_obj, orig_key, new_val) + assert not np.allclose(orig_val, attr_obj[orig_key]) + assert np.allclose(attr_obj[orig_key], new_val) + + orig_key = 'Attribute_np_2d' + orig_val = attr_obj[orig_key] + new_val = np.array([[7, 8.1, 9], [10, 11, 12.1]]) + alter_attr(dset_obj, orig_key, new_val) + assert not np.allclose(orig_val, attr_obj[orig_key]) + assert np.allclose(attr_obj[orig_key], new_val) + + # Try providing dset as str but no file + orig_key = 'Attribute_int' + new_val = 3 + with pytest.raises(TypeError): + alter_attr('base', orig_key, new_val)
    + +
    [docs]def test_write_attr_dict(hdf_dataset): + """ Try writing dictionary of attributes """ + + filename, fid = hdf_dataset + dset_obj = fid['base'] + + attr_dict = _OrderedDict([['WDA2', 2], ['WDA1', 1]]) + + # Write via dset obj + assert write_attr_dict(dset_obj, attr_dict, fid=None, sort_attrs=False, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + assert dset_obj.attrs['Attribute_str'] == 'Test' + l_attr = list(dset_obj.attrs.keys()) + + # Order should be that written + l_attr[-2] == 'WDA2' + l_attr[-1] == 'WDA1' + + # Write via dset str MISSING fid + with pytest.raises(TypeError): + write_attr_dict('base', attr_dict, fid=None, sort_attrs=False, verbose=False) + + # Write via dset str + assert write_attr_dict('base', attr_dict, fid=fid, sort_attrs=False, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + assert dset_obj.attrs['Attribute_str'] == 'Test' + + # Write via dset str and SORT attr + assert write_attr_dict('base', attr_dict, fid=fid, sort_attrs=True, verbose=False) + assert dset_obj.attrs['WDA2'] == 2 + assert dset_obj.attrs['WDA1'] == 1 + + # Order should be sorted. WDA* are the last alphanumerically in this test file + l_attr = list(dset_obj.attrs.keys()) + l_attr[-1] == 'WDA2' + l_attr[-2] == 'WDA1'
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_create.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_create.html new file mode 100644 index 0000000..3d5d35d --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_create.html @@ -0,0 +1,183 @@ + + + + + + + + crikit.io.lazy5.tests.test_create — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_create

    +""" Test creation of HDF5 files """
    +import os
    +import time
    +
    +import pytest
    +
    +import numpy as np
    +import h5py
    +
    +from crikit.io.lazy5.create import save
    +from crikit.io.lazy5.utils import FidOrFile
    +
    +
    +
    [docs]def test_save_no_attrs(): + data = np.random.randn(20,20) + filename = 'temp_create.h5' + dset_name = '/Group1/Dset' + save(filename, dset_name, data, mode='w') + + fof = FidOrFile(filename) + fid = fof.fid + assert np.allclose(fid[dset_name], data) + fof.close_if_file_not_fid() + + # Test re-write + data = np.random.randn(20,20) + save(filename, dset_name, data, mode='w') + fof = FidOrFile(filename) + fid = fof.fid + assert np.allclose(fid[dset_name], data) + fof.close_if_file_not_fid() + + # Test re-write when overwrite of dset set to False + data = np.random.randn(20,20) + with pytest.raises(IOError): + save(filename, dset_name, data, dset_overwrite=False) + + # Test re-write with attributes + data = np.random.randn(20,20) + attr_dict = {'AT1':1, 'AT2':2} + save(filename, dset_name, data, attr_dict=attr_dict, mode='w') + + fof = FidOrFile(filename) + fid = fof.fid + assert fid[dset_name].attrs['AT1'] == 1 + assert fid[dset_name].attrs['AT2'] == 2 + with pytest.raises(KeyError): + fid[dset_name].attrs['DOESNOTEXIST'] == 2 + + fof.close_if_file_not_fid() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename))
    + + +
    [docs]def test_save_diff_path(): + data = np.random.randn(20,20) + filename = 'temp_create2.h5' + dset_name = '/Group1/Dset' + + pth = './temp_test' + os.mkdir(pth) + + save(filename, dset_name, data, pth=pth, mode='w') + + fp = os.path.join(pth, filename) + + assert os.path.isdir(pth) + assert os.path.isfile(fp) + assert os.path.getsize(fp) >= data.nbytes + + os.remove(fp) + os.rmdir(pth)
    + +
    [docs]def test_save_to_open_h5_file(): + """ Test saving to an H5 file where the H5 file id is passed """ + + data = np.random.randn(20,20) + filename = 'temp_create2.h5' + dset_name = '/Group1/Dset' + + pth = './temp_test' + os.mkdir(pth) + assert os.path.isdir(pth) + + fp = os.path.join(pth, filename) + with h5py.File(fp, 'w') as fid: + save(fid, dset_name, data, pth=pth, mode='w') + + assert os.path.isfile(fp) + assert os.path.getsize(fp) >= data.nbytes + + os.remove(fp) + os.rmdir(pth)
    + +
    [docs]def test_save_to_open_wrong_type(): + """ Test saving to an inappripriate input (not string or h5 file fid) """ + + with pytest.raises(TypeError): + save(123, 'Name', np.random.rand(10,10), pth=None, mode='w')
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_inspect.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_inspect.html new file mode 100644 index 0000000..92383e8 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_inspect.html @@ -0,0 +1,428 @@ + + + + + + + + crikit.io.lazy5.tests.test_inspect — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_inspect

    +""" Test inspection of HDF5 files """
    +import os
    +import time
    +
    +import h5py
    +import pytest
    +
    +import numpy as np
    +from numpy.testing import assert_array_almost_equal
    +
    +from crikit.io.lazy5.inspect import (get_groups, get_datasets, get_hierarchy,
    +                                     get_attrs_dset, valid_dsets, valid_file)
    +
    +from crikit.io.lazy5.utils import hdf_is_open
    +
    +
    [docs]@pytest.fixture(scope="module") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs['Attribute_np_bytes_inarray'] = np.array(b'Test') # pylint: disable=no-member + fid['base'].attrs['Attribute_np_bytes_inarray2'] = np.array([b'Test']) # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + fid['base'].attrs.create('Attribute_np_sgl_int', np.array([1])) + fid['base'].attrs.create('Attribute_np_sgl_float', np.array([1.0])) + fid['base'].attrs.create('Attribute_np_array_float', np.array([1.0, 2.0])) + fid['base'].attrs.create('Attribute_np_sgl_complex', np.array([1.0 + 1j])) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + + time.sleep(1) + try: + os.remove(filename) + except Exception: + print('Could not delete {}'.format(filename))
    + +
    [docs]def test_valid_file(hdf_dataset): # pylint:disable=redefined-outer-name + """ Test whether a file is valid or not """ + + filename, fid = hdf_dataset + + assert valid_file(filename, verbose=True) + assert not valid_file('NOT_A_REAL_FILE.XYZ', verbose=True)
    + +
    [docs]def test_valid_dsets(hdf_dataset): # pylint:disable=redefined-outer-name + """ Test whether a dset or list of dsets are valid or not """ + + filename, fid = hdf_dataset + + # NOT valid filename + assert not valid_dsets('NOTAFILE.XYZ', 'base', verbose=True) + + # Single dataset + dset_list = 'base' + assert valid_dsets(filename, dset_list, verbose=True) + + # Single dataset by fid + dset_list = 'base' + assert valid_dsets(fid, dset_list, verbose=True) + + # Single dataset is WRONG + dset_list = 'NOTADSET' + assert not valid_dsets(filename, dset_list, verbose=True) + + # Single dataset in list + dset_list = ['base'] + assert valid_dsets(filename, dset_list, verbose=True) + + # Datasets in list -- NOTE some have leading slashes, some don't + dset_list = ['base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + 'Group2/ingroup2'] + assert valid_dsets(filename, dset_list, verbose=True) + + # Datasets in list -- 1 IS WRONG + dset_list = ['base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + 'Group2/DOESNOTEXIST'] + assert not valid_dsets(filename, dset_list, verbose=True) + + # Dataset with wrong-type + dset_list = 1 + with pytest.raises(TypeError): + valid_dsets(filename, dset_list, verbose=True) + + # Dataset with wrong-type + dset_list = ['base', 1] + with pytest.raises(TypeError): + valid_dsets(filename, dset_list, verbose=True)
    + +
    [docs]def test_get_groups(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's group list """ + + filename, fid = hdf_dataset + + # Passing fid + grp_list = get_groups(fid) + assert set(grp_list) == {'/', '/Group1', '/Group2', '/Group2/Group3', '/Group4', '/Group4/Group5', + '/Group4/Group5/Group6'} + + # Passing filename + grp_list = get_groups(filename) + assert set(grp_list) == {'/', '/Group1', '/Group2', '/Group2/Group3', '/Group4', '/Group4/Group5', + '/Group4/Group5/Group6'}
    + +
    [docs]def test_get_datasets_fullpath(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with groupnames prepended""" + filename, fid = hdf_dataset + + # Passing fid + dataset_list = get_datasets(fid, fulldsetpath=True) + assert set(dataset_list) == {'/base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + '/Group2/ingroup2', '/Group2/Group3/ingroup3', + '/Group4/Group5/Group6/ingroup6'} + + # Passing filename + dataset_list = get_datasets(filename, fulldsetpath=True) + assert set(dataset_list) == {'/base', '/Group1/ingroup1_1', '/Group1/ingroup1_2', + '/Group2/ingroup2', '/Group2/Group3/ingroup3', + '/Group4/Group5/Group6/ingroup6'}
    + +
    [docs]def test_get_datasets_nopath(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with no groupnames prepended """ + filename, fid = hdf_dataset + + # Passing fid + dataset_list = get_datasets(fid, fulldsetpath=False) + assert set(dataset_list) == {'base', 'ingroup1_1', 'ingroup1_2', 'ingroup2', + 'ingroup3', 'ingroup6'} + + # Passing filename + dataset_list = get_datasets(filename, fulldsetpath=False) + assert set(dataset_list) == {'base', 'ingroup1_1', 'ingroup1_2', 'ingroup2', + 'ingroup3', 'ingroup6'}
    + +
    [docs]def test_get_hierarchy_fullpath(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing with full paths in + the dataset names. Keys are groups, values are datasets. + """ + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=True, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=True, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + }
    + +
    [docs]def test_get_hierarchy_grp_w_dset(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing empty sets are NOT + returned. Keys are groups, values are datasets. + """ + + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=True, grp_w_dset=True) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + } + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=True, grp_w_dset=True) + assert hierarchy == {'/':['base'], + '/Group1':['/Group1/ingroup1_1', '/Group1/ingroup1_2'], + '/Group2':['/Group2/ingroup2'], + '/Group2/Group3':['/Group2/Group3/ingroup3'], + '/Group4/Group5/Group6':['/Group4/Group5/Group6/ingroup6'] + }
    + +
    [docs]def test_get_hierarchy_nopath(hdf_dataset): # pylint:disable=redefined-outer-name + """ + OrderedDict describing HDF5 file hierarchy. Testing with no full paths in + the dataset names. Keys are groups, values are datasets. + """ + filename, fid = hdf_dataset + + # Passing fid + hierarchy = get_hierarchy(fid, fulldsetpath=False, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['ingroup1_1', 'ingroup1_2'], + '/Group2':['ingroup2'], + '/Group2/Group3':['ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['ingroup6'] + } + + + # Passing filename + hierarchy = get_hierarchy(filename, fulldsetpath=False, grp_w_dset=False) + assert hierarchy == {'/':['base'], + '/Group1':['ingroup1_1', 'ingroup1_2'], + '/Group2':['ingroup2'], + '/Group2/Group3':['ingroup3'], + '/Group4':[], + '/Group4/Group5':[], + '/Group4/Group5/Group6':['ingroup6']}
    + + +
    [docs]def test_get_dset_attrs(hdf_dataset): # pylint:disable=redefined-outer-name + """ Get an HDF5 file's dataset list with groupnames prepended""" + + filename, fid = hdf_dataset + + # Passing fid + # DO NOT CONVERT-to-STR + dset_attrs = get_attrs_dset(fid, 'base', convert_to_str=False) + assert dset_attrs['Attribute_str'] == 'Test' + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # assert dset_attrs['Attribute_bytes'] == b'Test' + + assert dset_attrs['Attribute_np_bytes'] == b'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == b'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == b'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # DO CONVERT-to-STR + dset_attrs = get_attrs_dset(fid, 'base', convert_to_str=True) + assert dset_attrs['Attribute_str'] == 'Test' + assert dset_attrs['Attribute_bytes'] == 'Test' + assert dset_attrs['Attribute_np_bytes'] == 'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == 'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == 'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # Passing filename + # DO NOT CONVERT-to-STR + dset_attrs = get_attrs_dset(filename, 'base', convert_to_str=False) + assert dset_attrs['Attribute_str'] == 'Test' + + # NOTE: looks like hdf5 has changed how byte strings are delt with, maybe + # assert dset_attrs['Attribute_bytes'] == b'Test' + + assert dset_attrs['Attribute_np_bytes'] == b'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == b'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == b'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # DO CONVERT-to-STR + dset_attrs = get_attrs_dset(filename, 'base', convert_to_str=True) + assert dset_attrs['Attribute_str'] == 'Test' + assert dset_attrs['Attribute_bytes'] == 'Test' + assert dset_attrs['Attribute_np_bytes'] == 'Test' + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray'] == 'Test', True) + assert np.allclose(dset_attrs['Attribute_np_bytes_inarray2'] == 'Test', True) + assert dset_attrs['Attribute_int'] == 1 + assert dset_attrs['Attribute_float'] == 1.1 + assert np.allclose(dset_attrs['Attribute_np_1d'], np.array([1, 2, 3])) + assert np.allclose(dset_attrs['Attribute_np_2d'], np.array([[1, 2, 3], [4, 5, 6]])) + assert dset_attrs['Attribute_np_sgl_int'] == np.array([1]) + assert dset_attrs['Attribute_np_sgl_float'] == np.array([1.0]) + assert dset_attrs['Attribute_np_sgl_complex'] == np.array([1.0 + 1j]) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + + # CONVERT Single Numpy Value to Numeric + dset_attrs = get_attrs_dset(filename, 'base', convert_sgl_np_to_num=True) + assert dset_attrs['Attribute_np_sgl_int'] == 1 + assert isinstance(dset_attrs['Attribute_np_sgl_int'], int) + assert not isinstance(dset_attrs['Attribute_np_sgl_int'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_float'] == 1.0 + assert isinstance(dset_attrs['Attribute_np_sgl_float'], float) + assert not isinstance(dset_attrs['Attribute_np_sgl_float'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_complex'] == 1.0 + 1j + assert isinstance(dset_attrs['Attribute_np_sgl_complex'], complex) + assert not isinstance(dset_attrs['Attribute_np_sgl_complex'], np.ndarray) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + assert isinstance(dset_attrs['Attribute_np_array_float'], np.ndarray) + + # DO NOT CONVERT Single Numpy Value to Numeric + dset_attrs = get_attrs_dset(filename, 'base', convert_sgl_np_to_num=False) + assert dset_attrs['Attribute_np_sgl_int'] == 1 + assert not isinstance(dset_attrs['Attribute_np_sgl_int'], int) + assert isinstance(dset_attrs['Attribute_np_sgl_int'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_float'] == 1.0 + assert not isinstance(dset_attrs['Attribute_np_sgl_float'], float) + assert isinstance(dset_attrs['Attribute_np_sgl_float'], np.ndarray) + assert dset_attrs['Attribute_np_sgl_complex'] == 1.0 + 1j + assert not isinstance(dset_attrs['Attribute_np_sgl_complex'], complex) + assert isinstance(dset_attrs['Attribute_np_sgl_complex'], np.ndarray) + assert_array_almost_equal(dset_attrs['Attribute_np_array_float'], np.array([1.0, 2.0])) + assert isinstance(dset_attrs['Attribute_np_array_float'], np.ndarray)
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_nonh5utils.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_nonh5utils.html new file mode 100644 index 0000000..878f8e2 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_nonh5utils.html @@ -0,0 +1,210 @@ + + + + + + + + crikit.io.lazy5.tests.test_nonh5utils — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_nonh5utils

    +""" Test non-HDF-related utilities """
    +import pytest
    +
    +import numpy as np
    +
    +import crikit.io.lazy5 as lazy5
    +from crikit.io.lazy5.nonh5utils import (filterlist, check_type_compat, return_family_type)
    +
    +
    [docs]def test_filter_list(): + """ Test filtering of lists """ + list_to_filter = ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1', 'Exclude2'] + + # Keep, filter=str, exclusive + filters = 'Keep' + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Exclude, filter=str, exclusive + filters = 'Exclude' + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=True) + assert out_list == ['Keep1', 'Keep2'] + + # Keep, filter=list, exclusive + filters = ['Keep'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Keep, filter=tuple, exclusive + filters = ('Keep') + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude'] + + # Keep, filter=list, exclusive + filters = ['Keep', '1'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=True) + assert out_list == ['Keep1'] + + # Keep, filter=list, NOT-exclusive + filters = ['Keep', '1'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=True, + exclusive=False) + assert out_list == ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1'] + + # Exclude, filter=list, exclusive + filters = ['Exclude', '2'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=True) + assert out_list == ['Keep1'] + + # Exclude, filter=list, NON-exclusive + filters = ['Exclude', '2'] + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=False) + + assert out_list == ['Keep1', 'Keep2', 'KeepExclude', 'Exclude1'] + + # Wrong type of filter + filters = 1 + with pytest.raises(TypeError): + out_list = filterlist(list_to_filter, filters, keep_filtered_items=False, + exclusive=False)
    + +
    [docs]def test_return_family_type(): + """ Test return_family_type """ + assert return_family_type(1) is int + assert return_family_type(1.1) is float + assert return_family_type(1 + 1j*3) is complex + assert return_family_type('Test') is str + assert return_family_type(b'Test') is bytes + assert return_family_type(True) is bool + + assert return_family_type(np.int32(1)) is int + assert return_family_type(int(1)) is int + assert return_family_type(np.float32(1.1)) is float + assert return_family_type(float(1.1)) is float + assert return_family_type(np.complex64(1 + 1j*3)) is complex + assert return_family_type(complex(1 + 1j*3)) is complex + assert return_family_type(str('Test')) is str + assert return_family_type(np.str_('Test')) is str # pylint: disable=E1101 + assert return_family_type(np.bytes_('Test')) is bytes # pylint: disable=E1101 + assert return_family_type(bool(True)) is bool + assert return_family_type(np.bool_(True)) is bool + + with pytest.raises(TypeError): + return_family_type([1, 2, 3]) + + with pytest.raises(TypeError): + return_family_type((1, 2, 3)) + + with pytest.raises(TypeError): + return_family_type({'a':1})
    + + +
    [docs]def test_check_type_compat(): + """ Test check_type_compat[ibility] """ + + # Positive tests + assert check_type_compat(1, 2) + assert check_type_compat(1.1, 2.1) + assert check_type_compat(1.1+1j*3, 2.1+1j*8) + assert check_type_compat('Test', 'Test2') + assert check_type_compat(b'Test', b'Test2') + assert check_type_compat(True, False) + + assert check_type_compat(1, np.int32(2)) + assert check_type_compat(1.1, np.float32(2.1)) + assert check_type_compat(1.1+1j*3, np.complex64(2.1+1j*8)) + assert check_type_compat('Test', np.str_('Test2')) # pylint: disable=E1101 + assert check_type_compat(b'Test', np.bytes_('Test2')) # pylint: disable=E1101 + assert check_type_compat(True, np.bool_(False)) + + # Negative checks + assert not check_type_compat(1, 2.1) + assert not check_type_compat(1.1, 2) + assert not check_type_compat(1.1+1j*3, 2.1) + assert not check_type_compat('Test', 1) + assert not check_type_compat('Test', b'Test2') + assert not check_type_compat(True, 1) + + assert not check_type_compat(1.1, np.int32(2)) + assert not check_type_compat(1, np.float32(2.1)) + assert not check_type_compat(1, np.complex64(2.1+1j*8)) + assert not check_type_compat(1, np.str_('Test2')) # pylint: disable=E1101 + assert not check_type_compat('Test', np.bytes_('Test2')) # pylint: disable=E1101 + assert not check_type_compat(1, np.bool_(False))
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_ui.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_ui.html new file mode 100644 index 0000000..97d19e0 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_ui.html @@ -0,0 +1,243 @@ + + + + + + + + crikit.io.lazy5.tests.test_ui — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_ui

    +""" Test inspection of HDF5 files """
    +import os
    +import sys
    +import h5py
    +
    +import numpy as np
    +import pytest
    +
    +try:
    +    from PyQt5.QtWidgets import QApplication
    +    from PyQt5.QtTest import QTest
    +    import PyQt5.QtCore
    +    from PyQt5.QtCore import Qt
    +except Exception:
    +    HAS_PYQT5 = False
    +else:
    +    HAS_PYQT5 = True
    +    import crikit.io.lazy5 as lazy5
    +    from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad
    +
    +from crikit.io.lazy5.utils import hdf_is_open
    +
    +
    [docs]@pytest.mark.skipif(not HAS_PYQT5, reason='PyQt5 not installed, skipping.') +class TestUI: + """ Test the HDF5 PyQt5 Viewer """ + +
    [docs] @pytest.fixture(scope="module") + def hdf_dataset(self): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test_ui.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + + fid.create_dataset('base', data=data) + + grp1 = fid.create_group('Group1') + grp3 = fid.create_group('Group2/Group3') + grp6 = fid.create_group('Group4/Group5/Group6') + + grp1.create_dataset('ingroup1_1', data=data) + grp1.create_dataset('ingroup1_2', data=data) + fid.create_dataset('Group2/ingroup2', data=data) + grp3.create_dataset('ingroup3', data=data) + + grp6.create_dataset('ingroup6', data=data) + + fid['base'].attrs['Attribute_str'] = 'Test' + fid['base'].attrs['Attribute_bytes'] = b'Test' + fid['base'].attrs['Attribute_np_bytes'] = np.bytes_('Test') # pylint: disable=no-member + fid['base'].attrs.create('Attribute_int', 1) + fid['base'].attrs.create('Attribute_float', 1.1) + fid['base'].attrs.create('Attribute_np_1d', np.array([1, 2, 3])) + fid['base'].attrs.create('Attribute_np_2d', np.array([[1, 2, 3], [4, 5, 6]])) + + app = QApplication(sys.argv) # pylint: disable=C0103, W0612 + yield filename + + # Tear-down + if hdf_is_open(fid): + fid.close() + os.remove(filename)
    + # sys.exit() + +
    [docs] def test_ui_win_title_empty_load_dataset(self, hdf_dataset): + """ Test whether load dataset dialog is titled properly with no title provided""" + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + assert dialog.windowTitle() == 'Select a dataset...'
    + +
    [docs] def test_ui_win_title_load_dataset(self, hdf_dataset): + """ Test whether load dataset dialog is titled properly """ + self.filename = hdf_dataset + dialog = HdfLoad(title='TEST') + _ = dialog.fileOpen(self.filename) + + assert dialog.windowTitle() == 'TEST: Select a dataset...'
    + +
    [docs] def test_ui_load_file(self, hdf_dataset): + """ Load test file and check groups """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + + list_grps = [dialog.ui.comboBoxGroupSelect.itemText(num) for num in + range(dialog.ui.comboBoxGroupSelect.count())] + + assert list_dsets == ['base'] + assert '/Group1' in list_grps + assert '/Group2/Group3' in list_grps + assert '/Group4/Group5/Group6' in list_grps + assert '/Group5' not in list_grps
    + +
    [docs] def test_ui_change_grp_and_filter_include(self, hdf_dataset): + """ Load test file, change to Group1, filter for _1 """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(1) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/Group1' + assert list_dsets == ['ingroup1_1', 'ingroup1_2'] + + dialog.ui.filterIncludeString.setText('_1') + QTest.mouseClick(dialog.ui.pushButtonFilter, Qt.LeftButton) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert list_dsets == ['ingroup1_1']
    + +
    [docs] def test_ui_change_grp_and_filter_exclude(self, hdf_dataset): + """ Load test file, change to Group1, filter for _1 """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(1) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/Group1' + assert list_dsets == ['ingroup1_1', 'ingroup1_2'] + + dialog.ui.filterExcludeString.setText('_1') + QTest.mouseClick(dialog.ui.pushButtonFilter, Qt.LeftButton) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert list_dsets == ['ingroup1_2']
    + +
    [docs] def test_ui_attrs(self, hdf_dataset): + """ Load test file, change to base group (/), check attributes """ + self.filename = hdf_dataset + dialog = HdfLoad() + _ = dialog.fileOpen(self.filename) + + # Change group to Group1 + dialog.ui.comboBoxGroupSelect.setCurrentIndex(0) + list_dsets = [dialog.ui.listDataSet.item(num).text() for num in + range(dialog.ui.listDataSet.count())] + assert dialog.ui.comboBoxGroupSelect.currentText() == '/' + assert list_dsets == ['base'] + + # Select dataset base + dialog.ui.listDataSet.item(0).setSelected(True) + QTest.mouseClick(dialog.ui.listDataSet.viewport(), Qt.LeftButton) + + assert (dialog.ui.tableAttributes.findItems('Attribute_str', Qt.MatchExactly)[0].text() == + 'Attribute_str') + assert not dialog.ui.tableAttributes.findItems('fake', Qt.MatchExactly) # Empty
    + +
    [docs] def test_ui_wrongfile(self, hdf_dataset): + """ Load test file, change to base group (/), check attributes """ + self.filename = hdf_dataset + dialog = HdfLoad() + with pytest.raises(FileNotFoundError): + _ = dialog.fileOpen('does_not_exist.h5')
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/tests/test_utils.html b/docs/build/html/_modules/crikit/io/lazy5/tests/test_utils.html new file mode 100644 index 0000000..83ee6b1 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/tests/test_utils.html @@ -0,0 +1,186 @@ + + + + + + + + crikit.io.lazy5.tests.test_utils — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.tests.test_utils

    +""" Test HDF-related utilities """
    +import os
    +
    +import pytest
    +
    +import h5py
    +import numpy as np
    +
    +import crikit.io.lazy5 as lazy5
    +from crikit.io.lazy5.utils import (FidOrFile, hdf_is_open, fullpath)
    +
    +
    [docs]@pytest.fixture(scope="module") +def hdf_dataset(): + """ Setups and tears down a sample HDF5 file """ + filename = 'temp_test_utils.h5' + fid = h5py.File(filename, 'w') + data_m, data_n, data_p = [20, 22, 24] + data = np.random.randn(data_m, data_n, data_p) + fid.create_dataset('base', data=data) + + yield filename, fid + + # Tear-down + if hdf_is_open(fid): + fid.close() + os.remove(filename)
    + +
    [docs]def test_fid_or_file_filename_provided(hdf_dataset): + """ Test FidOrFile Class with provided filename """ + filename, _ = hdf_dataset + + fof = FidOrFile(filename) + + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + assert fof.fid is not None + assert not fof.is_fid + + fof.fid.close()
    + +
    [docs]def test_fid_or_file_fid_provided(hdf_dataset): + """ Test FidOrFile Class with provided fid """ + _, fid = hdf_dataset + + fof = FidOrFile(fid) + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + assert fof.fid is not None + assert fof.is_fid
    + +
    [docs]def test_fid_or_file_close_if_not_fid(hdf_dataset): + """ Test close if filename was provided """ + filename, fid = hdf_dataset + + fof = FidOrFile(fid) + fof.close_if_file_not_fid() + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 1 + + fof = FidOrFile(filename) + fof.close_if_file_not_fid() + # ! New h5py v 2.9.*: id instead of fid + try: + status = fof.fid.id.valid + except AttributeError: + status = fof.fid.fid.valid + + assert status == 0
    + +
    [docs]def test_hdf_is_open(hdf_dataset): + """ Test hdf_is_open function """ + _, fid = hdf_dataset + + assert hdf_is_open(fid) + fid.close() + + assert not hdf_is_open(fid)
    + +
    [docs]def test_fullpath(): + """ Test full path """ + fp = fullpath(filename=None,pth=None) + assert fp is None + + fn = 'test.XYZ' + p = 'Dir1/Dir2' + + fp = fullpath(filename=fn,pth=None) + assert fp == fn + + fp = fullpath(filename=fn, pth=p) + assert fp == os.path.join(p, fn)
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/ui/QtHdfLoad.html b/docs/build/html/_modules/crikit/io/lazy5/ui/QtHdfLoad.html new file mode 100644 index 0000000..6cfdc12 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/ui/QtHdfLoad.html @@ -0,0 +1,322 @@ + + + + + + + + crikit.io.lazy5.ui.QtHdfLoad — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.ui.QtHdfLoad

    +"""
    +HDF5 LOAD DATA QDialog (crikit.vis.subguis.h5loadgui)
    +=======================================================
    +
    +    H5LoadGUI : A graphical user interface (GUI) to select HDF5 dataset(s)
    +
    +    Method : H5LoadGUI.getFileDataSets()
    +
    +    Return (tuple) : (path [str], filename [str], dataset(s) [list], selection_made [bool])
    +
    +    Notes
    +    -----
    +    Methods that interact with Qt follow the Qt naming convention:
    +    firstSecondThird
    +"""
    +
    +
    +# Append sys path
    +import sys as _sys
    +import os as _os
    +
    +try:
    +    # Generic imports for QT-based programs
    +    from PyQt5.QtWidgets import (QApplication as _QApplication, \
    +    QDialog as _QDialog, QFileDialog as _QFileDialog, \
    +    QTableWidgetItem as _QTableWidgetItem)
    +except Exception:
    +    HAS_PYQT5 = False
    +else:
    +    HAS_PYQT5 = True
    +from crikit.io.lazy5.ui.qt_HdfLoad import Ui_Dialog
    +
    +from crikit.io.lazy5.inspect import get_hierarchy, get_attrs_dset
    +from crikit.io.lazy5.nonh5utils import filterlist
    +
    +
    [docs]class HdfLoad(_QDialog): ### EDIT ### + """ GUI Loader Class for H5 Files """ + + # Default configuration + config = {'only_show_grp_w_dset': True, # Only show groups with datasets + 'attr_description': 'Memo', # Description attribute key (optional) + 'excl_filtering' : True # Filtering is exclusive (filters are AND'd) + } + + def __init__(self, title=None, parent=None): + + # Generic load/init designer-based GUI + super(HdfLoad, self).__init__(parent) + self.ui = Ui_Dialog() # pylint: disable=C0103 + self.ui.setupUi(self) + + self.path = None + self.filename = None + self.all_selected = None + self.group_dset_dict = None + + if title: + self.setWindowTitle('{}: Select a dataset...'.format(title)) + else: + self.setWindowTitle('Select a dataset...') + + self.ui.pushButtonOk.clicked.connect(self.accept) + self.ui.pushButtonCancel.clicked.connect(self.reject) + self.ui.comboBoxGroupSelect.currentTextChanged.connect(self.dataGroupChange) + self.ui.listDataSet.itemClicked.connect(self.datasetSelected) + self.ui.pushButtonFilter.clicked.connect(self.filterDatasets) + self.ui.pushButtonResetFilter.clicked.connect(self.dataGroupChange) + + +
    [docs] @staticmethod + def getFileDataSets(pth='./', title=None, parent=None): # pylint: disable=C0103; # pragma: no cover + """ + Retrieve the filename and datasets selected by the user (via GUI) + + Parameters + ---------- + pth : str + Home directory to start in OR the relative pth to a file + + Returns + ---------- + Tuple (str, str, list[str]) as (path, filename, [dataset(s)]) + + """ + + # pragma: no cover + dialog = HdfLoad(title=title, parent=parent) + + ret_fileopen = True + if pth is None: + pth = './' + else: + pth = _os.path.abspath(pth) + + while True: + ret_fileopen = dialog.fileOpen(pth, title=title) + + ret = None + if ret_fileopen: + ret_dset_select = dialog.exec_() + if ret_dset_select == _QDialog.Rejected: + pth = dialog.path + elif dialog.all_selected is None: + pass + else: + ret = (dialog.path, dialog.filename, dialog.all_selected) + break + else: + break + return ret
    + +
    [docs] def fileOpen(self, pth='./', title=None): # Qt-related pylint: disable=C0103 + """ Select HDF5 File via QDialog built-in.""" + + if pth is None: + pth = './' + + if title is None: + title_file='Select a file...' + else: + title_file='{}: Select a file...'.format(title) + + if _os.path.isdir(pth): # No file provided, use QFileDialog; # pragma: no cover + filetype_options = 'HDF5 Files (*.h5 *.hdf);;All Files (*.*)' + full_pth_fname, _ = _QFileDialog.getOpenFileName(self, title_file, pth, + filetype_options) + elif _os.path.isfile(pth): # Is a valid file + full_pth_fname = pth + else: + raise FileNotFoundError('Not a valid path. Not a valid file.') + + ret = None + if full_pth_fname: + full_pth_fname = _os.path.abspath(full_pth_fname) # Ensure correct /'s for each OS + self.filename = _os.path.basename(full_pth_fname) + self.path = _os.path.dirname(full_pth_fname) + self.populateGroups() + ret = True + return ret
    + +
    [docs] def populateGroups(self): # Qt-related pylint: disable=C0103 + """ Populate dropdown box of group ui.comboBoxGroupSelect """ + self.group_dset_dict = get_hierarchy(_os.path.join(self.path, self.filename), + grp_w_dset=HdfLoad.config['only_show_grp_w_dset']) + # Load Group dropdown box + self.ui.comboBoxGroupSelect.clear() + for count in self.group_dset_dict: + self.ui.comboBoxGroupSelect.addItem(count) + return [self.path, self.filename]
    + +
    [docs] def dataGroupChange(self): # Qt-related pylint: disable=C0103 + """ Action : ComboBox containing Groups with DataSets has changed""" + + #self.dsetlist = QListWidget(self.verticalLayoutWidget) + self.ui.listDataSet.clear() + + if self.ui.comboBoxGroupSelect.currentText() != '': + self.ui.listDataSet.addItems(self.group_dset_dict[self.ui.comboBoxGroupSelect.currentText()])
    + #print('Changed') + +
    [docs] def populate_attrs(self, attr_dict=None): + """ Populate attribute and memo boxes for currently selected dataset """ + + self.ui.tableAttributes.setRowCount(0) + self.ui.tableAttributes.setColumnCount(2) + self.ui.tableAttributes.setSortingEnabled(False) + self.ui.textDescription.setText('') + + if attr_dict: + try: + self.ui.textDescription.setText(attr_dict[HdfLoad.config['attr_description']]) + except (KeyError, AttributeError) as error_msg: + print('{}\nNo memo at key {}'.format(error_msg, HdfLoad.config['attr_description'])) + + for num, key in enumerate(attr_dict): + self.ui.tableAttributes.insertRow(self.ui.tableAttributes.rowCount()) + self.ui.tableAttributes.setItem(num, 0, _QTableWidgetItem(key)) + self.ui.tableAttributes.setItem(num, 1, _QTableWidgetItem(str(attr_dict[key])))
    + +
    [docs] def datasetSelected(self): # Qt-related pylint: disable=C0103 + """ Action : One or more DataSets were selected from the list """ + + all_selected = self.ui.listDataSet.selectedItems() + n_selected = len(all_selected) + + self.ui.textCurrentDataset.setText('') + self.all_selected = [] + attrs = {} + + if n_selected > 0: + current_selection = all_selected[-1].text() + current_grp = self.ui.comboBoxGroupSelect.currentText() + + selection_str = '{} + ({} others)'.format(current_selection, n_selected - 1) + self.ui.textCurrentDataset.setText(selection_str) + if current_grp == '/': + current_dset_fullpath = '{}{}'.format(current_grp, current_selection) + else: + current_dset_fullpath = '{}/{}'.format(current_grp, current_selection) + # TODO: Figure out a better way to deal with base-group datasets + # Bug when dsets are in base group '/' + current_dset_fullpath = current_dset_fullpath.replace('//','/') + attrs = get_attrs_dset(_os.path.join(self.path, self.filename), + current_dset_fullpath, convert_to_str=True) + self.all_selected = [('{}/{}'.format(current_grp, selection.text())).replace('//','/') + for selection in all_selected] + + # Fill-in attribute table + self.populate_attrs(attr_dict=attrs)
    + +
    [docs] def filterDatasets(self): # Qt-related pylint: disable=C0103 + """ Filter list of datasets based on include and exclude strings """ + incl_str = self.ui.filterIncludeString.text() + excl_str = self.ui.filterExcludeString.text() + + # From string with comma separation to list-of-strings + incl_list = [q.strip() for q in incl_str.split(',') if q.strip()] + excl_list = [q.strip() for q in excl_str.split(',') if q.strip()] + + dset_list = [self.ui.listDataSet.item(num).text() for num in + range(self.ui.listDataSet.count())] + + if incl_list: # Include list is not empty + dset_list = filterlist(dset_list, incl_list, + keep_filtered_items=True, + exclusive=HdfLoad.config['excl_filtering']) + + if excl_list: # Exclude list is not empty + dset_list = filterlist(dset_list, excl_list, + keep_filtered_items=False, + exclusive=HdfLoad.config['excl_filtering']) + + self.ui.listDataSet.clear() + self.ui.listDataSet.addItems(dset_list)
    + +if __name__ == '__main__': # pragma: no cover + app = _QApplication(_sys.argv) # pylint: disable=C0103 + result = HdfLoad.getFileDataSets(pth='.', title='Test title') # pylint: disable=C0103 + print('Result: {}'.format(result)) + + _sys.exit() + # pylint: error +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/ui/qt_HdfLoad.html b/docs/build/html/_modules/crikit/io/lazy5/ui/qt_HdfLoad.html new file mode 100644 index 0000000..6cd15f8 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/ui/qt_HdfLoad.html @@ -0,0 +1,237 @@ + + + + + + + + crikit.io.lazy5.ui.qt_HdfLoad — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.ui.qt_HdfLoad

    +# -*- coding: utf-8 -*-
    +
    +# Form implementation generated from reading ui file '.\ui_HdfLoad.ui'
    +#
    +# Created by: PyQt5 UI code generator 5.8.1
    +#
    +# WARNING! All changes made in this file will be lost!
    +
    +from PyQt5 import QtCore, QtGui, QtWidgets
    +
    +
    [docs]class Ui_Dialog(object): +
    [docs] def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(845, 588) + Dialog.setStyleSheet("font: 10pt \"Arial\";") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) + self.verticalLayout.setObjectName("verticalLayout") + self.topHL = QtWidgets.QHBoxLayout() + self.topHL.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint) + self.topHL.setObjectName("topHL") + self.dataSetVL = QtWidgets.QVBoxLayout() + self.dataSetVL.setObjectName("dataSetVL") + self.label_1 = QtWidgets.QLabel(Dialog) + self.label_1.setObjectName("label_1") + self.dataSetVL.addWidget(self.label_1) + self.comboBoxGroupSelect = QtWidgets.QComboBox(Dialog) + self.comboBoxGroupSelect.setObjectName("comboBoxGroupSelect") + self.dataSetVL.addWidget(self.comboBoxGroupSelect) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.dataSetVL.addWidget(self.label_2) + self.listDataSet = QtWidgets.QListWidget(Dialog) + self.listDataSet.setEditTriggers(QtWidgets.QAbstractItemView.DoubleClicked|QtWidgets.QAbstractItemView.EditKeyPressed|QtWidgets.QAbstractItemView.SelectedClicked) + self.listDataSet.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listDataSet.setObjectName("listDataSet") + self.dataSetVL.addWidget(self.listDataSet) + self.label_3 = QtWidgets.QLabel(Dialog) + self.label_3.setObjectName("label_3") + self.dataSetVL.addWidget(self.label_3) + self.filterIncludeString = QtWidgets.QLineEdit(Dialog) + self.filterIncludeString.setObjectName("filterIncludeString") + self.dataSetVL.addWidget(self.filterIncludeString) + self.label_4 = QtWidgets.QLabel(Dialog) + self.label_4.setObjectName("label_4") + self.dataSetVL.addWidget(self.label_4) + self.filterExcludeString = QtWidgets.QLineEdit(Dialog) + self.filterExcludeString.setObjectName("filterExcludeString") + self.dataSetVL.addWidget(self.filterExcludeString) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.pushButtonFilter = QtWidgets.QPushButton(Dialog) + self.pushButtonFilter.setObjectName("pushButtonFilter") + self.horizontalLayout.addWidget(self.pushButtonFilter) + self.pushButtonResetFilter = QtWidgets.QPushButton(Dialog) + self.pushButtonResetFilter.setObjectName("pushButtonResetFilter") + self.horizontalLayout.addWidget(self.pushButtonResetFilter) + self.dataSetVL.addLayout(self.horizontalLayout) + self.topHL.addLayout(self.dataSetVL) + self.attribVL = QtWidgets.QVBoxLayout() + self.attribVL.setObjectName("attribVL") + self.label_5 = QtWidgets.QLabel(Dialog) + self.label_5.setObjectName("label_5") + self.attribVL.addWidget(self.label_5) + self.textCurrentDataset = QtWidgets.QTextBrowser(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.textCurrentDataset.sizePolicy().hasHeightForWidth()) + self.textCurrentDataset.setSizePolicy(sizePolicy) + self.textCurrentDataset.setMaximumSize(QtCore.QSize(16777215, 100)) + self.textCurrentDataset.setObjectName("textCurrentDataset") + self.attribVL.addWidget(self.textCurrentDataset) + self.label_6 = QtWidgets.QLabel(Dialog) + self.label_6.setObjectName("label_6") + self.attribVL.addWidget(self.label_6) + self.tableAttributes = QtWidgets.QTableWidget(Dialog) + self.tableAttributes.setStyleSheet("") + self.tableAttributes.setColumnCount(2) + self.tableAttributes.setObjectName("tableAttributes") + self.tableAttributes.setRowCount(0) + item = QtWidgets.QTableWidgetItem() + font = QtGui.QFont() + font.setPointSize(10) + item.setFont(font) + item.setBackground(QtGui.QColor(121, 121, 121)) + brush = QtGui.QBrush(QtGui.QColor(91, 91, 91)) + brush.setStyle(QtCore.Qt.SolidPattern) + item.setForeground(brush) + self.tableAttributes.setHorizontalHeaderItem(0, item) + item = QtWidgets.QTableWidgetItem() + item.setBackground(QtGui.QColor(123, 123, 123)) + brush = QtGui.QBrush(QtGui.QColor(91, 91, 91)) + brush.setStyle(QtCore.Qt.SolidPattern) + item.setForeground(brush) + self.tableAttributes.setHorizontalHeaderItem(1, item) + self.tableAttributes.horizontalHeader().setCascadingSectionResizes(True) + self.tableAttributes.horizontalHeader().setDefaultSectionSize(200) + self.tableAttributes.horizontalHeader().setHighlightSections(False) + self.tableAttributes.horizontalHeader().setSortIndicatorShown(True) + self.tableAttributes.horizontalHeader().setStretchLastSection(True) + self.tableAttributes.verticalHeader().setVisible(False) + self.tableAttributes.verticalHeader().setHighlightSections(False) + self.attribVL.addWidget(self.tableAttributes) + self.label_7 = QtWidgets.QLabel(Dialog) + self.label_7.setObjectName("label_7") + self.attribVL.addWidget(self.label_7) + self.textDescription = QtWidgets.QTextBrowser(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.textDescription.sizePolicy().hasHeightForWidth()) + self.textDescription.setSizePolicy(sizePolicy) + self.textDescription.setMaximumSize(QtCore.QSize(16777215, 100)) + self.textDescription.setObjectName("textDescription") + self.attribVL.addWidget(self.textDescription) + self.topHL.addLayout(self.attribVL) + self.verticalLayout.addLayout(self.topHL) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setContentsMargins(-1, 10, -1, -1) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.pushButtonOk = QtWidgets.QPushButton(Dialog) + self.pushButtonOk.setObjectName("pushButtonOk") + self.horizontalLayout_2.addWidget(self.pushButtonOk) + self.pushButtonCancel = QtWidgets.QPushButton(Dialog) + self.pushButtonCancel.setObjectName("pushButtonCancel") + self.horizontalLayout_2.addWidget(self.pushButtonCancel) + self.verticalLayout.addLayout(self.horizontalLayout_2) + self.verticalLayout_2.addLayout(self.verticalLayout) + + self.retranslateUi(Dialog) + QtCore.QMetaObject.connectSlotsByName(Dialog)
    + +
    [docs] def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "HDF File Inspector")) + self.label_1.setText(_translate("Dialog", "Groups Containing Datasets")) + self.label_2.setText(_translate("Dialog", "Datasets")) + self.label_3.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Include</span> Entires with Substring (separate by \',\' [comma])</p></body></html>")) + self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Exclude</span> Entires with Substring (separate by \',\' [comma])</p></body></html>")) + self.pushButtonFilter.setText(_translate("Dialog", "Filter List")) + self.pushButtonResetFilter.setText(_translate("Dialog", "Reset List")) + self.label_5.setText(_translate("Dialog", "Current Selection")) + self.label_6.setText(_translate("Dialog", "Atrribute Table")) + self.tableAttributes.setSortingEnabled(True) + item = self.tableAttributes.horizontalHeaderItem(0) + item.setText(_translate("Dialog", "Attribute")) + item = self.tableAttributes.horizontalHeaderItem(1) + item.setText(_translate("Dialog", "Value")) + self.label_7.setText(_translate("Dialog", "Dataset Information (Memo)")) + self.pushButtonOk.setText(_translate("Dialog", "OK")) + self.pushButtonCancel.setText(_translate("Dialog", "Cancel"))
    + +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/lazy5/utils.html b/docs/build/html/_modules/crikit/io/lazy5/utils.html new file mode 100644 index 0000000..64040c5 --- /dev/null +++ b/docs/build/html/_modules/crikit/io/lazy5/utils.html @@ -0,0 +1,173 @@ + + + + + + + + crikit.io.lazy5.utils — CRIKit2 0.4.3 documentation + + + + + + + + + + + +
    +
    +
    +
    + +

    Source code for crikit.io.lazy5.utils

    +""" Utility functions """
    +import os as _os
    +
    +import h5py as _h5py
    +import numpy as _np
    +
    +from .config import DefaultConfig
    +_h5py.get_config().complex_names = DefaultConfig().complex_names
    +
    +__all__ = ['FidOrFile', 'hdf_is_open', 'fullpath']
    +
    +
    [docs]class FidOrFile: + """ + Class for opening an HDF5 file and returning a file ID (fid) or if passed + and already open fid, passing it along (pass-thru). Primarily for enabling + functions and methods to operate on open and closed files. + + Parameters + ---------- + file : str or h5py.File + Filename or File-object for open HDF5 file + + mode : str + If opening a file, open with mode. Available: r,r+,w,w-,x,a + + Attributes + ---------- + is_fid : bool + Was the input file actually an fid. + + fid : h5py.File object + File ID + """ + def __init__(self, file=None, mode='r'): + self.is_fid = None + self.fid = None + if file is not None: + self.return_fid_from_file(file, mode=mode) + +
    [docs] def return_fid_from_file(self, file, mode='r'): + """ + Return an open fid (h5py.File). If provided a string, open file, else + pass-thru given fid. + + Parameters + ---------- + file : str or h5py.File + Filename or File-object for open HDF5 file + + mode : str + If opening a file, open with mode. Available: r,r+,w,w-,x,a + + Returns + ------- + fid : h5py.File object + File ID + + """ + self.is_fid = isinstance(file, _h5py.File) + if not self.is_fid: + self.fid = _h5py.File(file, mode=mode) + else: + self.fid = file + return self.fid
    + +
    [docs] def close_if_file_not_fid(self): + """ Close the file if originally a filename (not a fid) was passed """ + if not self.is_fid: + return self.fid.close() + else: + return None
    + +
    [docs]def hdf_is_open(fid): + """ Is an HDF file open via fid """ + # ! New h5py v 2.9.*: id instead of fid + try: + status = fid.id.valid + except AttributeError: + status = fid.fid.valid + + if status == 0: + return False + elif status == 1: + return True + else: + return None
    + +
    [docs]def fullpath(filename, pth=None): + """ Return a full path by joining a pth and filename """ + if not pth: + return filename + else: + return _os.path.join(pth, filename)
    +
    + +
    +
    +
    +
    + +
    +
    + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/macros.html b/docs/build/html/_modules/crikit/io/macros.html index 24fbad7..22969c7 100644 --- a/docs/build/html/_modules/crikit/io/macros.html +++ b/docs/build/html/_modules/crikit/io/macros.html @@ -5,15 +5,13 @@ - crikit.io.macros — CRIKit2 0.4.1 documentation - - - + crikit.io.macros — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,19 +41,28 @@

    Source code for crikit.io.macros

     
     @author: chc
     """
    -import os as _os
     
    -import lazy5 
    +import crikit.io.lazy5 as lazy5
     
     from crikit.io.meta_configs import (special_nist_bcars2 as _snb,
                                         special_nist_bcars1_sample_scan as _snb1ss)
     from crikit.io.meta_process import meta_process as _meta_process
    -from crikit.io.hdf5 import hdf_import_data as _hdf_import_data
    +from crikit.io.hdf5 import (hdf_import_data as _hdf_import_data, hdf_import_data_macroraster as _hdf_import_data_macroraster)
     from crikit.io.csv_nist import csv_nist_import_data as _csv_nist_import_data
     
     __all__ = ['import_hdf_nist_special', 'import_csv_nist_special1']
     
     
    +def hdf_nist_special_macroraster(pth, filename, dset_list, output_cls_instance):
    +    print('\n')
    +    import_success = _hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance)
    +    if import_success is False:
    +        raise ValueError('hdf_import_data_macroraster failed')
    +        return False
    +    _meta_process(_snb(), output_cls_instance)
    +    return True
    +
    +
     
    [docs]def import_hdf_nist_special(pth, filename, dset, output_cls_instance): """ Import data from HDF File as specified by NIST-specific settings @@ -65,7 +72,7 @@

    Source code for crikit.io.macros

         Success : bool
             Whether import was successful
         """
    -    
    +
         print('\n')
         import_success = _hdf_import_data(pth, filename, dset, output_cls_instance)
         if import_success is False:
    @@ -74,6 +81,7 @@ 

    Source code for crikit.io.macros

         _meta_process(_snb(), output_cls_instance)
         return True
    + def import_hdf_nist_special_ooc(pth, filename, dset, output_cls_instance): """ Import data from HDF File (OUT-OF-CORE) as specified by NIST-specific settings @@ -83,7 +91,7 @@

    Source code for crikit.io.macros

         Success : bool
             Whether import was successful
         """
    -    
    +
         print('\n')
     
         try:
    @@ -91,12 +99,13 @@ 

    Source code for crikit.io.macros

             output_cls_instance._data = fid[dset]
             output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset)
             _meta_process(_snb(), output_cls_instance)
    -    except:
    +    except Exception:
             raise ValueError('hdf_import_data failed')
             return False
         else:
    -        return fid    
    -        
    +        return fid
    +
    +
     
    [docs]def import_csv_nist_special1(pth, filename_header, filename_data, output_cls_instance): """ @@ -114,34 +123,34 @@

    Source code for crikit.io.macros

             if import_success is None or import_success is False:
                 raise ValueError('csv_import_data returned None')
             _meta_process(_snb1ss(), output_cls_instance)
    -    except:
    +    except Exception:
             print('Something failed in import_csv_nist_special')
             return False
         else:
             return True
    + if __name__ == '__main__': # pragma: no cover - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi pth = '../' filename = 'mP2_w_small.h5' img = _Hsi() - import_hdf_nist_special(pth, filename,'/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small',img) + import_hdf_nist_special(pth, filename, '/BCARSImage/mP2_3_5ms_Pos_2_0/mP2_3_5ms_Pos_2_0_small', img) print('Shape of img: {}'.format(img.shape)) print('Shape of img.mean(): {}'.format(img.mean().shape)) print(img.y_rep.data) - - # from crikit.data.spectrum import Spectrum as _Spectrum - + + # from crikit.data.spectra import Spectrum as _Spectrum + # sp = _Spectrum() # pth = '../../../Young_150617/' # filename_header = 'SH-03.h' # filename_data = 'base061715_152213_60ms.txt' - + # import_csv_nist_special1(pth, filename_header, filename_data, # output_cls_instance=sp) -
    @@ -154,7 +163,7 @@

    Source code for crikit.io.macros

       

    Quick search

    @@ -173,14 +182,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/meta_configs.html b/docs/build/html/_modules/crikit/io/meta_configs.html index f0e6a7d..9313028 100644 --- a/docs/build/html/_modules/crikit/io/meta_configs.html +++ b/docs/build/html/_modules/crikit/io/meta_configs.html @@ -5,15 +5,13 @@ - crikit.io.meta_configs — CRIKit2 0.4.1 documentation - - - + crikit.io.meta_configs — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -49,50 +47,47 @@

    Source code for crikit.io.meta_configs

     @author: chc
     """
     
    +
     
    [docs]def special_nist_bcars2(): """ Return import attributes particular to the "BCARS 2" system at NIST """ rosetta = {} - rosetta['XPixelSize'] = ['RasterScanParams.FastAxisStepSize', - 'Raster.Fast.StepSize','!',1] - rosetta['XStart'] = ['RasterScanParams.FastAxisStart', 'Raster.Fast.Start'] - rosetta['XStop'] = ['RasterScanParams.FastAxisStop', 'Raster.Fast.Stop'] - rosetta['XLength'] = ['RasterScanParams.FastAxisSteps', 'Raster.Fast.Steps'] - rosetta['XLabel'] = ['RasterScanParams.FastAxis','Raster.Fast.Axis','!','X'] - rosetta['XUnits'] = ['RasterScanParams.FastAxisUnits','!','$\\mu$m'] - - rosetta['YPixelSize'] = ['RasterScanParams.SlowAxisStepSize', - 'Raster.Slow.StepSize','!',1] - rosetta['YStart'] = ['RasterScanParams.SlowAxisStart', 'Raster.Slow.Start'] - rosetta['YStop'] = ['RasterScanParams.SlowAxisStop', 'Raster.Slow.Stop'] - rosetta['YLength'] = ['RasterScanParams.SlowAxisSteps', 'Raster.Slow.Steps'] - rosetta['YLabel'] = ['RasterScanParams.SlowAxis','Raster.Slow.Axis','!','Y'] - rosetta['YUnits'] = ['RasterScanParams.SlowAxisUnits','!','$\\mu$m'] - - rosetta['ZPosition'] = ['RasterScanParams.FixedAxisPosition', - 'Raster.Stack.Position','!',0] - rosetta['ZLabel'] = ['RasterScanParams.FixedAxis', 'Raster.Stack.Axis','!','Z'] + rosetta['XPixelSize'] = ['Macro.Raster.Fast.StepSize', 'RasterScanParams.FastAxisStepSize', + 'Raster.Fast.StepSize', '!', 1] + rosetta['XStart'] = ['Macro.Raster.Fast.Start', 'RasterScanParams.FastAxisStart', 'Raster.Fast.Start'] + rosetta['XStop'] = ['Macro.Raster.Fast.Stop', 'RasterScanParams.FastAxisStop', 'Raster.Fast.Stop'] + rosetta['XLength'] = ['Macro.Raster.Fast.Steps', 'RasterScanParams.FastAxisSteps', 'Raster.Fast.Steps'] + rosetta['XLabel'] = ['Macro.Raster.Fast.Axis', 'RasterScanParams.FastAxis', 'Raster.Fast.Axis', '!', 'X'] + rosetta['XUnits'] = ['MicroStage.raster.fast.units', 'RasterScanParams.FastAxisUnits', '!', '$\\mu$m'] + + rosetta['YPixelSize'] = ['Macro.Raster.Slow.StepSize', 'RasterScanParams.SlowAxisStepSize', 'Raster.Slow.StepSize', '!', 1] + rosetta['YStart'] = ['Macro.Raster.Slow.Start', 'RasterScanParams.SlowAxisStart', 'Raster.Slow.Start'] + rosetta['YStop'] = ['Macro.Raster.Slow.Stop', 'RasterScanParams.SlowAxisStop', 'Raster.Slow.Stop'] + rosetta['YLength'] = ['Macro.Raster.Slow.Steps', 'RasterScanParams.SlowAxisSteps', 'Raster.Slow.Steps'] + rosetta['YLabel'] = ['Macro.Raster.Slow.Axis', 'RasterScanParams.SlowAxis', 'Raster.Slow.Axis', '!', 'Y'] + rosetta['YUnits'] = ['MicroStage.raster.slow.units', 'RasterScanParams.SlowAxisUnits', '!', '$\\mu$m'] + + # TODO: Set an actual Z fixed position for Macro raster scan + rosetta['ZPosition'] = ['Macro.Raster.Fixed.Start', 'Raster.Fixed.Position','RasterScanParams.FixedAxisPosition', + 'Raster.Stack.Position', '!', 0] + rosetta['ZLabel'] = ['Macro.Raster.Fixed.Axis', 'RasterScanParams.FixedAxis', 'Raster.Fixed.Axis', 'Raster.Stack.Axis', '!', 'Z'] # Color Calibration - rosetta['ColorCenterWL'] = ['Spectro.CenterWavelength', - 'Spectro.CurrentWavelength', 'Calib.ctr_wl', - '!', 729.994] + rosetta['ColorCenterWL'] = ['Spectrometer.calib.ctr_wl', 'Spectro.CenterWavelength', 'Spectro.CurrentWavelength', 'Calib.ctr_wl', '!', 729.994] rosetta['ColorUnits'] = ['Calib.units', '!', 'nm'] - rosetta['ColorChannels'] = ['Calib.n_pix', 'Spectro.SpectralPixels','!', 1600] - rosetta['ColorCalibWL'] = ['Calib.ctr_wl0', 'Spectro.CalibWavelength', '!', 729.994] - rosetta['ColorPolyVals'] = ['Calib.a_vec', 'Spectro.Avec', '!', [-0.167740721307557, - 863.8736708961577]] + rosetta['ColorChannels'] = ['Spectrometer.calib.n_pix', 'Calib.n_pix', 'Spectro.SpectralPixels', '!', 1600] + rosetta['ColorCalibWL'] = ['Spectrometer.calib.ctr_wl0', 'Calib.ctr_wl0', 'Spectro.CalibWavelength', '!', 729.994] + rosetta['ColorPolyVals'] = ['Spectrometer.calib.a_vec', 'Calib.a_vec', 'Spectro.Avec', '!', [-0.167740721307557, 863.8736708961577]] - rosetta['ColorProbe'] = ['Calib.probe', 'Spectro.ProbeWavelength', '!', 771.461] + rosetta['ColorProbe'] = ['Spectrometer.calib.probe', 'Calib.probe', 'Spectro.ProbeWavelength', '!', 771.461] rosetta['ColorWnMode'] = ['!', True] # Color Calibration Original rosetta['OrigColorCenterWL'] = ['CalibOrig.ctr_wl', 'Spectro.CenterWavelength', - 'Spectro.CurrentWavelength', - ] + 'Spectro.CurrentWavelength'] rosetta['OrigColorUnits'] = ['CalibOrig.units'] rosetta['OrigColorChannels'] = ['CalibOrig.n_pix'] rosetta['OrigColorCalibWL'] = ['CalibOrig.ctr_wl'] @@ -104,6 +99,7 @@

    Source code for crikit.io.meta_configs

     
         return rosetta
    +
    [docs]def special_nist_bcars1_sample_scan(): """ Return import attributes particular to the "BCARS 1" system at NIST @@ -128,7 +124,7 @@

    Source code for crikit.io.meta_configs

         rosetta['ZLabel'] = 'RasterScanParams.FixedAxis'
     
         rosetta['ColorCenterWL'] = ['Frequency Calibration.CenterWavelength', '!', 696.831]
    -    rosetta['ColorUnits'] = ['!','nm']
    +    rosetta['ColorUnits'] = ['!', 'nm']
         rosetta['ColorChannels'] = ['Frequency Calibration.freq index length', '!', 512]
         rosetta['ColorCalibWL'] = ['Frequency Calibration.CenterWavelength', '!', 696.831]
     
    @@ -139,9 +135,9 @@ 

    Source code for crikit.io.meta_configs

         rosetta['ColorPolyVals'] = ['Frequency Calibration.Polyvals', '!',
                                     [-0.50418919, 825.651318]]
     
    -    rosetta['ColorProbe'] = ['Frequency Calibration.probe(nm)','!', 830.0]
    +    rosetta['ColorProbe'] = ['Frequency Calibration.probe(nm)', '!', 830.0]
         rosetta['ColorWnMode'] = ['!', True]
    -    # rosetta['ColorCalibWN'] = ['Processing.WNCalib','Processing.WNCalibOrig']
    +    # rosetta['ColorCalibWN'] = ['Processing.WNCalib', 'Processing.WNCalibOrig']
     
         return rosetta
    @@ -156,7 +152,7 @@

    Source code for crikit.io.meta_configs

       

    Quick search

    @@ -175,14 +171,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/meta_process.html b/docs/build/html/_modules/crikit/io/meta_process.html index b8f7d69..f34604a 100644 --- a/docs/build/html/_modules/crikit/io/meta_process.html +++ b/docs/build/html/_modules/crikit/io/meta_process.html @@ -5,15 +5,13 @@ - crikit.io.meta_process — CRIKit2 0.4.1 documentation - - - + crikit.io.meta_process — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -47,9 +45,9 @@

    Source code for crikit.io.meta_process

     from crikit.data.frequency import (calib_pix_wn as _calib_pix_wn,
                                        calib_pix_wl as _calib_pix_wl)
     
    -from crikit.data.spectrum import Spectrum as _Spectrum
    +from crikit.data.spectra import Spectrum as _Spectrum
     from crikit.data.spectra import Spectra as _Spectra
    -from crikit.data.hsi import Hsi as _Hsi
    +from crikit.data.spectra import Hsi as _Hsi
     
     import numpy as _np
     
    @@ -78,7 +76,7 @@ 

    Source code for crikit.io.meta_process

                             break
                     else:
                         pass
    -            except:
    +            except Exception:
                     temp_val = None
                     temp_key = None
     
    @@ -90,7 +88,7 @@ 

    Source code for crikit.io.meta_process

         elif isinstance(rosetta[key],str):
             try:
                 temp = output_cls_instance._meta[rosetta[key]]
    -        except:
    +        except Exception:
                 return None
             else:
                 return (temp, rosetta[key])
    @@ -112,7 +110,7 @@ 

    Source code for crikit.io.meta_process

         calib_dict['a_vec'] = temp[0]
         del temp
     
    -    temp = rosetta_query('ColorChannels',rosetta, output_cls_instance)
    +    temp = rosetta_query('ColorChannels', rosetta, output_cls_instance)
         print('Color/Frequency-Channels: {} from {}'.format(temp[0], temp[1]))
         if temp[0] != output_cls_instance.shape[-1]:
             print('WARNING: Number of color channels assigned in meta data ({}) disagrees with datacube size ({})'.format(temp[0], output_cls_instance.shape[-1]))
    @@ -176,7 +174,7 @@ 

    Source code for crikit.io.meta_process

             calib_orig_dict['probe'] = rosetta_query('OrigColorProbe',rosetta, output_cls_instance)[0]
             calib_orig_dict['units'] = rosetta_query('OrigColorUnits',rosetta, output_cls_instance)[0]
     
    -    except:
    +    except Exception:
             print('Original calibration not found.')
         else:
             print('Original calibration found.')
    @@ -296,7 +294,7 @@ 

    Source code for crikit.io.meta_process

                 output_cls_instance.reps.data = _np.arange(output_cls_instance.data.shape[0])
         #        print(output_cls_instance.reps.data.shape)
                 output_cls_instance.reps.update_calib_from_data()
    -        except:
    +        except Exception:
                 print('Something failed in meta_process: Spectra rep-calib')
     
         elif type(output_cls_instance) == _Spectrum:
    @@ -337,7 +335,7 @@ 

    Source code for crikit.io.meta_process

       

    Quick search

    @@ -356,14 +354,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/io/tests/test_hdf5.html b/docs/build/html/_modules/crikit/io/tests/test_hdf5.html index a53ad1d..3229cf2 100644 --- a/docs/build/html/_modules/crikit/io/tests/test_hdf5.html +++ b/docs/build/html/_modules/crikit/io/tests/test_hdf5.html @@ -5,15 +5,13 @@ - crikit.io.tests.test_hdf5 — CRIKit2 0.4.1 documentation - - - + crikit.io.tests.test_hdf5 — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -44,12 +42,12 @@

    Source code for crikit.io.tests.test_hdf5

     
     import pytest
     import h5py
    -import lazy5
    +import crikit.io.lazy5 as lazy5
     
     from crikit.io.hdf5 import hdf_import_data
    -from crikit.data.spectrum import Spectrum
    +from crikit.data.spectra import Spectrum
     from crikit.data.spectra import Spectra
    -from crikit.data.hsi import Hsi
    +from crikit.data.spectra import Hsi
     
     
    [docs]@pytest.fixture(scope="module") def hdf_dataset(): @@ -238,7 +236,7 @@

    Source code for crikit.io.tests.test_hdf5

       

    Quick search

    @@ -257,14 +255,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/fftspatialnoise.html b/docs/build/html/_modules/crikit/measurement/fftspatialnoise.html index d6e2be3..48a9d8d 100644 --- a/docs/build/html/_modules/crikit/measurement/fftspatialnoise.html +++ b/docs/build/html/_modules/crikit/measurement/fftspatialnoise.html @@ -5,15 +5,13 @@ - crikit.measurement.fftspatialnoise — CRIKit2 0.4.1 documentation - - - + crikit.measurement.fftspatialnoise — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -157,7 +155,7 @@

    Source code for crikit.measurement.fftspatialnoise

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/peakamps.html b/docs/build/html/_modules/crikit/measurement/peakamps.html index 5400195..3fddb13 100644 --- a/docs/build/html/_modules/crikit/measurement/peakamps.html +++ b/docs/build/html/_modules/crikit/measurement/peakamps.html @@ -5,15 +5,13 @@ - crikit.measurement.peakamps — CRIKit2 0.4.1 documentation - - - + crikit.measurement.peakamps — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -706,7 +704,7 @@

    Source code for crikit.measurement.peakamps

       

    Quick search

    @@ -725,14 +723,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/peakfind.html b/docs/build/html/_modules/crikit/measurement/peakfind.html index 9ec0f7a..27c6aee 100644 --- a/docs/build/html/_modules/crikit/measurement/peakfind.html +++ b/docs/build/html/_modules/crikit/measurement/peakfind.html @@ -5,15 +5,13 @@ - crikit.measurement.peakfind — CRIKit2 0.4.1 documentation - - - + crikit.measurement.peakfind — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -169,7 +167,7 @@

    Source code for crikit.measurement.peakfind

                 try:
                     deriv = _convolve(deriv, PeakFinder.haar(wv_width), mode='same', 
                                       method=method)
    -            except:
    +            except Exception:
                     print('peakfind.py | cwt_diff: Likely using an old version of SciPy (no convolve method parameter)')
                     deriv = _convolve(deriv, PeakFinder.haar(wv_width), mode='same')
             return deriv
    @@ -225,7 +223,7 @@

    Source code for crikit.measurement.peakfind

             
             amps_retr = []
             for l, s in zip(omegas_retr_locs, sigma_retr_locs):
    -            dl = _np.abs(_np.ceil((l - s)/10)).astype(_np.integer)
    +            dl = _np.abs(_np.ceil((l - s)/10)).astype(_np.int32)
                 amps_retr.append(_np.median(y[l-dl:l+dl+1]))
             amps_retr = _np.array(amps_retr)
     
    @@ -318,7 +316,7 @@ 

    Source code for crikit.measurement.peakfind

       

    Quick search

    @@ -337,14 +335,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/tests/test_measurement.html b/docs/build/html/_modules/crikit/measurement/tests/test_measurement.html index d3b8950..a421b85 100644 --- a/docs/build/html/_modules/crikit/measurement/tests/test_measurement.html +++ b/docs/build/html/_modules/crikit/measurement/tests/test_measurement.html @@ -5,15 +5,13 @@ - crikit.measurement.tests.test_measurement — CRIKit2 0.4.1 documentation - - - + crikit.measurement.tests.test_measurement — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,7 +41,7 @@

    Source code for crikit.measurement.tests.test_measurement

    import pytest -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.measurement.peakamps import (MeasurePeak, MeasurePeakAdd, MeasurePeakMinus, MeasurePeakMultiply, MeasurePeakDivide, MeasurePeakMax, MeasurePeakMin, @@ -311,7 +309,7 @@

    Source code for crikit.measurement.tests.test_measurement

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/tests/test_measurements_complex.html b/docs/build/html/_modules/crikit/measurement/tests/test_measurements_complex.html index c03e636..dc63294 100644 --- a/docs/build/html/_modules/crikit/measurement/tests/test_measurements_complex.html +++ b/docs/build/html/_modules/crikit/measurement/tests/test_measurements_complex.html @@ -5,15 +5,13 @@ - crikit.measurement.tests.test_measurements_complex — CRIKit2 0.4.1 documentation - - - + crikit.measurement.tests.test_measurements_complex — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -43,7 +41,7 @@

    Source code for crikit.measurement.tests.test_measurements_complex

    import pytest -from crikit.data.hsi import Hsi +from crikit.data.spectra import Hsi from crikit.measurement.peakamps import (MeasurePeak, MeasurePeakAdd, MeasurePeakMinus, MeasurePeakMultiply, MeasurePeakDivide, MeasurePeakMax, MeasurePeakMin, @@ -311,7 +309,7 @@

    Source code for crikit.measurement.tests.test_measurements_complex

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/measurement/tests/test_peakfind.html b/docs/build/html/_modules/crikit/measurement/tests/test_peakfind.html index 2585279..4eafc70 100644 --- a/docs/build/html/_modules/crikit/measurement/tests/test_peakfind.html +++ b/docs/build/html/_modules/crikit/measurement/tests/test_peakfind.html @@ -5,15 +5,13 @@ - crikit.measurement.tests.test_peakfind — CRIKit2 0.4.1 documentation - - - + crikit.measurement.tests.test_peakfind — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -101,7 +99,7 @@

    Source code for crikit.measurement.tests.test_peakfind

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/algorithms/abstract_als.html b/docs/build/html/_modules/crikit/preprocess/algorithms/abstract_als.html index 34d40ff..02b9818 100644 --- a/docs/build/html/_modules/crikit/preprocess/algorithms/abstract_als.html +++ b/docs/build/html/_modules/crikit/preprocess/algorithms/abstract_als.html @@ -5,15 +5,13 @@ - crikit.preprocess.algorithms.abstract_als — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.algorithms.abstract_als — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -103,7 +101,7 @@

    Source code for crikit.preprocess.algorithms.abstract_als

    # Dummy indep variable x = _np.arange(self.rng.size) x_sub = _np.linspace(x[0], x[-1], _np.round(x.size / - self.redux).astype(_np.integer)) + self.redux).astype(_np.int32)) self.redux_sig_shape = list(self.full_sig_shape) self.redux_sig_shape[-1] = x_sub.size self.redux_sig_spectral_size = self.redux_sig_shape[-1] @@ -122,7 +120,7 @@

    Source code for crikit.preprocess.algorithms.abstract_als

    # Spline interpolation/super-sampling for coords in _np.ndindex(output_sampled.shape[0:-1]): spl2 = _USpline(x_sub,output_sampled[coords],s=0) - output[[*coords, self.rng]] = spl2(x) + output[(*coords, self.rng)] = spl2(x) tmr -= _timeit.default_timer() self.t = -tmr @@ -139,7 +137,7 @@

    Source code for crikit.preprocess.algorithms.abstract_als

    return self._fix_rng else: redux_fix_rng = self._fix_rng / self.redux - redux_fix_rng = _np.unique(redux_fix_rng).astype(_np.integer) + redux_fix_rng = _np.unique(redux_fix_rng).astype(_np.int32) return redux_fix_rng
    @@ -153,7 +151,7 @@

    Source code for crikit.preprocess.algorithms.abstract_als

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/algorithms/als.html b/docs/build/html/_modules/crikit/preprocess/algorithms/als.html index 1de2d1f..f18fbfe 100644 --- a/docs/build/html/_modules/crikit/preprocess/algorithms/als.html +++ b/docs/build/html/_modules/crikit/preprocess/algorithms/als.html @@ -5,15 +5,13 @@ - crikit.preprocess.algorithms.als — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.algorithms.als — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -128,7 +126,7 @@

    Source code for crikit.preprocess.algorithms.als

    elif self.redux > 1: x = _np.arange(self.rng.size) x_sub = _np.linspace(x[0], x[-1], _np.round(x.size / - self.redux).astype(_np.integer)) + self.redux).astype(_np.int32)) spl = _USpline(x,self._asym_param[self.rng],s=0) return spl(x_sub) @@ -199,7 +197,7 @@

    Source code for crikit.preprocess.algorithms.als

    # Solve A * baseline_current = w_sp * Signal _cholmod.linsolve(minimazation_matrix,x,uplo='U') - except: + except Exception: print('Failure in Cholesky factorization') break else: @@ -273,7 +271,7 @@

    Source code for crikit.preprocess.algorithms.als

    Quick search

    @@ -292,14 +290,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/algorithms/anscombe.html b/docs/build/html/_modules/crikit/preprocess/algorithms/anscombe.html index c5de1fe..9d240fa 100644 --- a/docs/build/html/_modules/crikit/preprocess/algorithms/anscombe.html +++ b/docs/build/html/_modules/crikit/preprocess/algorithms/anscombe.html @@ -5,15 +5,13 @@ - crikit.preprocess.algorithms.anscombe — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.algorithms.anscombe — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -467,7 +465,7 @@

    Source code for crikit.preprocess.algorithms.anscombe

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/algorithms/arpls.html b/docs/build/html/_modules/crikit/preprocess/algorithms/arpls.html index 5bb3da4..61ed98d 100644 --- a/docs/build/html/_modules/crikit/preprocess/algorithms/arpls.html +++ b/docs/build/html/_modules/crikit/preprocess/algorithms/arpls.html @@ -5,15 +5,13 @@ - crikit.preprocess.algorithms.arpls — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.algorithms.arpls — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -175,7 +173,7 @@

    Source code for crikit.preprocess.algorithms.arpls

    import matplotlib.pyplot as _plt x = _np.linspace(0,1000,800) - data_orig = _np.abs(5/(300 - x -1j*10) + .005) + data_orig = _np.abs(5/(300 - x -1j*10) + .005) bg = _np.exp(-(x-500)**2/700**2) data = bg + data_orig @@ -227,7 +225,7 @@

    Source code for crikit.preprocess.algorithms.arpls

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/crop.html b/docs/build/html/_modules/crikit/preprocess/crop.html index 3807372..39e4e0c 100644 --- a/docs/build/html/_modules/crikit/preprocess/crop.html +++ b/docs/build/html/_modules/crikit/preprocess/crop.html @@ -5,15 +5,13 @@ - crikit.preprocess.crop — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.crop — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -72,7 +70,7 @@

    Source code for crikit.preprocess.crop

                     self.zero_col = _np.nonzero(row_sums)[0][self.fol]
     
                 ret_obj[:, self.zero_col, :] *= 0
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -114,7 +112,7 @@ 

    Source code for crikit.preprocess.crop

                     self.zero_row = _np.nonzero(col_sums)[0][self.fol]
     
                 ret_obj[self.zero_row, :, :] *= 0
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -268,7 +266,7 @@ 

    Source code for crikit.preprocess.crop

       

    Quick search

    @@ -287,14 +285,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/denoise.html b/docs/build/html/_modules/crikit/preprocess/denoise.html index d386203..372f017 100644 --- a/docs/build/html/_modules/crikit/preprocess/denoise.html +++ b/docs/build/html/_modules/crikit/preprocess/denoise.html @@ -5,15 +5,13 @@ - crikit.preprocess.denoise — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.denoise — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -115,7 +113,7 @@

    Source code for crikit.preprocess.denoise

                 else:
                     self._U, self._s, self._Vh = _svd(data[..., self.rng],
                                                    full_matrices=False)
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -220,7 +218,7 @@ 

    Source code for crikit.preprocess.denoise

                         #                        shp)
                         ret_obj[..., self.rng] += _np.reshape(_np.dot(U[:, self.svs], _np.dot(_np.diag(s[self.svs]),Vh[self.svs, :])), shp)
     
    -        except:
    +        except Exception:
                 return False
             else:
                 return True
    @@ -312,7 +310,7 @@ 

    Source code for crikit.preprocess.denoise

       

    Quick search

    @@ -331,14 +329,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/standardize.html b/docs/build/html/_modules/crikit/preprocess/standardize.html index cc18ace..b70cae6 100644 --- a/docs/build/html/_modules/crikit/preprocess/standardize.html +++ b/docs/build/html/_modules/crikit/preprocess/standardize.html @@ -5,15 +5,13 @@ - crikit.preprocess.standardize — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.standardize — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -196,7 +194,7 @@

    Source code for crikit.preprocess.standardize

    try: ret_obj *= 0 ret_obj[..., self.rng] = out - except: + except Exception: return False else: return True @@ -323,7 +321,7 @@

    Source code for crikit.preprocess.standardize

    try: ret_obj *= 0 ret_obj[..., self.rng] = out - except: + except Exception: return False else: return True @@ -370,7 +368,7 @@

    Source code for crikit.preprocess.standardize

    if __name__ == '__main__': # pragma: no cover - from crikit.data.spectrum import Spectrum as _Spectrum + from crikit.data.spectra import Spectrum as _Spectrum stddev = 20 gain = 1 @@ -461,7 +459,7 @@

    Source code for crikit.preprocess.standardize

    Quick search
    @@ -480,14 +478,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/subtract_baseline.html b/docs/build/html/_modules/crikit/preprocess/subtract_baseline.html index b26bae5..0d60053 100644 --- a/docs/build/html/_modules/crikit/preprocess/subtract_baseline.html +++ b/docs/build/html/_modules/crikit/preprocess/subtract_baseline.html @@ -5,15 +5,13 @@ - crikit.preprocess.subtract_baseline — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.subtract_baseline — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -123,7 +121,7 @@

    Source code for crikit.preprocess.subtract_baseline

    # ret_obj[idx] -= self._inst_als.calculate(data[idx].real) # else: ret_obj[idx] -= self._inst_als.calculate(data[idx].real) - except: + except Exception: return False else: # print(self._inst_als.__dict__) @@ -186,7 +184,7 @@

    Source code for crikit.preprocess.subtract_baseline

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/subtract_dark.html b/docs/build/html/_modules/crikit/preprocess/subtract_dark.html index 5d4a8c7..7f2ae0a 100644 --- a/docs/build/html/_modules/crikit/preprocess/subtract_dark.html +++ b/docs/build/html/_modules/crikit/preprocess/subtract_dark.html @@ -5,15 +5,13 @@ - crikit.preprocess.subtract_dark — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.subtract_dark — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -47,9 +45,9 @@

    Source code for crikit.preprocess.subtract_dark

    < import numpy as _np import copy as _copy -from crikit.data.spectrum import Spectrum as _Spectrum +from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra -from crikit.data.hsi import Hsi as _Hsi +from crikit.data.spectra import Hsi as _Hsi from crikit.utils.general import (expand_1d_to_ndim as _expand_1d_to_ndim, mean_nd_to_1d as _mean_nd_to_1d) @@ -190,7 +188,7 @@

    Source code for crikit.preprocess.subtract_dark

    <

    Quick search

    @@ -209,14 +207,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/subtract_mean.html b/docs/build/html/_modules/crikit/preprocess/subtract_mean.html index e4ec132..68701f7 100644 --- a/docs/build/html/_modules/crikit/preprocess/subtract_mean.html +++ b/docs/build/html/_modules/crikit/preprocess/subtract_mean.html @@ -5,15 +5,13 @@ - crikit.preprocess.subtract_mean — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.subtract_mean — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -65,7 +63,7 @@

    Source code for crikit.preprocess.subtract_mean

    < try: ret_obj -= meaner[..., None] - except: + except Exception: return False else: return True @@ -115,9 +113,9 @@

    Source code for crikit.preprocess.subtract_mean

    < if __name__ == '__main__': # pragma: no cover - from crikit.data.spectrum import Spectrum as _Spectrum + from crikit.data.spectra import Spectrum as _Spectrum from crikit.data.spectra import Spectra as _Spectra - from crikit.data.hsi import Hsi as _Hsi + from crikit.data.spectra import Hsi as _Hsi @@ -189,7 +187,7 @@

    Source code for crikit.preprocess.subtract_mean

    <

    Quick search

    @@ -208,14 +206,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/tests/test_als.html b/docs/build/html/_modules/crikit/preprocess/tests/test_als.html index 7ca43f1..c29c395 100644 --- a/docs/build/html/_modules/crikit/preprocess/tests/test_als.html +++ b/docs/build/html/_modules/crikit/preprocess/tests/test_als.html @@ -5,15 +5,13 @@ - crikit.preprocess.tests.test_als — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.tests.test_als — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -257,7 +255,7 @@

    Source code for crikit.preprocess.tests.test_als

    Quick search

    @@ -276,14 +274,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/tests/test_anscombe.html b/docs/build/html/_modules/crikit/preprocess/tests/test_anscombe.html index 50db154..84bd400 100644 --- a/docs/build/html/_modules/crikit/preprocess/tests/test_anscombe.html +++ b/docs/build/html/_modules/crikit/preprocess/tests/test_anscombe.html @@ -5,15 +5,13 @@ - crikit.preprocess.tests.test_anscombe — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.tests.test_anscombe — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -87,7 +85,7 @@

    Source code for crikit.preprocess.tests.test_anscombe

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/tests/test_baseline_sub.html b/docs/build/html/_modules/crikit/preprocess/tests/test_baseline_sub.html index 35df797..60dc2b1 100644 --- a/docs/build/html/_modules/crikit/preprocess/tests/test_baseline_sub.html +++ b/docs/build/html/_modules/crikit/preprocess/tests/test_baseline_sub.html @@ -5,15 +5,13 @@ - crikit.preprocess.tests.test_baseline_sub — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.tests.test_baseline_sub — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -248,7 +246,7 @@

    Source code for crikit.preprocess.tests.test_baseline_sub

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/tests/test_crop.html b/docs/build/html/_modules/crikit/preprocess/tests/test_crop.html index 492921f..b2ac269 100644 --- a/docs/build/html/_modules/crikit/preprocess/tests/test_crop.html +++ b/docs/build/html/_modules/crikit/preprocess/tests/test_crop.html @@ -5,15 +5,13 @@ - crikit.preprocess.tests.test_crop — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.tests.test_crop — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -100,7 +98,7 @@

    Source code for crikit.preprocess.tests.test_crop

    Quick search
    @@ -119,14 +117,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/preprocess/tests/test_subtract_dark.html b/docs/build/html/_modules/crikit/preprocess/tests/test_subtract_dark.html index b989784..8fa13a9 100644 --- a/docs/build/html/_modules/crikit/preprocess/tests/test_subtract_dark.html +++ b/docs/build/html/_modules/crikit/preprocess/tests/test_subtract_dark.html @@ -5,15 +5,13 @@ - crikit.preprocess.tests.test_subtract_dark — CRIKit2 0.4.1 documentation - - - + crikit.preprocess.tests.test_subtract_dark — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -274,8 +272,8 @@

    Source code for crikit.preprocess.tests.test_subtract_dark

    """ Dark is HSI. Data is HSI. """ spectrum, spectra, hsi, shape = make_datasets - data = (1*hsi).astype(np.float) - dark = (1*hsi).astype(np.int) + data = (1*hsi).astype(float) + dark = (1*hsi).astype(int) subdark = SubtractDark(dark) @@ -290,7 +288,7 @@

    Source code for crikit.preprocess.tests.test_subtract_dark

    np.testing.assert_array_almost_equal(out, data - dark.mean(axis=(0,1))[None,None,:]) # Transform - dark = (1*hsi).astype(np.int) + dark = (1*hsi).astype(int) subdark = SubtractDark(dark) success = subdark.transform(data) np.testing.assert_array_almost_equal(data, out) @@ -308,59 +306,59 @@

    Source code for crikit.preprocess.tests.test_subtract_dark

    spectrum, spectra, hsi, shape = make_datasets # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.int) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(int) subdark = SubtractDark(dark) subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.float) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(float) subdark = SubtractDark(dark) subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.int) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(int) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES RAISE ERROR - data = (1*hsi).astype(np.float) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(float) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) with pytest.raises(TypeError): subdark.transform(data) # DOES NOT RAISE ERROR - data = (1*hsi).astype(np.complex) - dark = (1*spectrum).astype(np.complex) + data = (1*hsi).astype(complex) + dark = (1*spectrum).astype(complex) subdark = SubtractDark(dark) subdark.transform(data)
    @@ -377,7 +375,7 @@

    Source code for crikit.preprocess.tests.test_subtract_dark

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/classes_ui.html b/docs/build/html/_modules/crikit/ui/classes_ui.html index 03a3b92..342b002 100644 --- a/docs/build/html/_modules/crikit/ui/classes_ui.html +++ b/docs/build/html/_modules/crikit/ui/classes_ui.html @@ -5,15 +5,13 @@ - crikit.ui.classes_ui — CRIKit2 0.4.1 documentation - - - + crikit.ui.classes_ui — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -120,7 +118,7 @@

    Source code for crikit.ui.classes_ui

             try:
                 temp = self.grayscaleimage.std()
                 return temp
    -        except:
    +        except Exception:
                 return None
     
         @property
    @@ -128,7 +126,7 @@ 

    Source code for crikit.ui.classes_ui

             try:
                 temp = self.grayscaleimage.mean()
                 return temp
    -        except:
    +        except Exception:
                 return None
     
         @property
    @@ -159,7 +157,7 @@ 

    Source code for crikit.ui.classes_ui

     
                     else:
                         pass
    -        except:
    +        except Exception:
                 print('Set grayscaleimage error')
     
         @grayscaleimage.deleter
    @@ -364,7 +362,7 @@ 

    Source code for crikit.ui.classes_ui

                 return SingleColor._bwtocolor(final_scaled_gs, self.colormap, self.bgcolor)
     
             else:
    -            fudge_factor = .001
    +            fudge_factor = .001
                 fudge_amt = _np.abs((self.setmax - self.setmin)*fudge_factor)
                 fudged_min = self.setmin - fudge_amt
                 fudged_max = self.setmax + fudge_amt
    @@ -472,7 +470,7 @@ 

    Source code for crikit.ui.classes_ui

       

    Quick search

    @@ -491,14 +489,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_AbstractFactorization.html b/docs/build/html/_modules/crikit/ui/dialog_AbstractFactorization.html index 09b5772..08780af 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_AbstractFactorization.html +++ b/docs/build/html/_modules/crikit/ui/dialog_AbstractFactorization.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_AbstractFactorization — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_AbstractFactorization — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -184,7 +182,7 @@

    Source code for crikit.ui.dialog_AbstractFactorization

    else: try: self.selected_factors.remove(self._first_factor_visible+count) - except: + except Exception: pass #print('Self.S: {}'.format(self.svddata.S[0:3])) @@ -380,7 +378,7 @@

    Source code for crikit.ui.dialog_AbstractFactorization

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_AbstractPlotEffect.html b/docs/build/html/_modules/crikit/ui/dialog_AbstractPlotEffect.html index ebd4005..cd0a34b 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_AbstractPlotEffect.html +++ b/docs/build/html/_modules/crikit/ui/dialog_AbstractPlotEffect.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_AbstractPlotEffect — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_AbstractPlotEffect — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -85,7 +83,7 @@

    Source code for crikit.ui.dialog_AbstractPlotEffect

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_AnscombeParams.html b/docs/build/html/_modules/crikit/ui/dialog_AnscombeParams.html index 35c1bd5..b2c0911 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_AnscombeParams.html +++ b/docs/build/html/_modules/crikit/ui/dialog_AnscombeParams.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_AnscombeParams — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_AnscombeParams — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -235,7 +233,7 @@

    Source code for crikit.ui.dialog_AnscombeParams

    <

    Quick search

    @@ -254,14 +252,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_SVD.html b/docs/build/html/_modules/crikit/ui/dialog_SVD.html index 42ab619..9494425 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_SVD.html +++ b/docs/build/html/_modules/crikit/ui/dialog_SVD.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_SVD — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_SVD — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -115,7 +113,7 @@

    Source code for crikit.ui.dialog_SVD

             """
             try:
                 return self.s.size
    -        except:
    +        except Exception:
                 return None
    [docs] def combiner(self, selections=None): @@ -255,7 +253,7 @@

    Source code for crikit.ui.dialog_SVD

       

    Quick search

    @@ -274,14 +272,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_kkOptions.html b/docs/build/html/_modules/crikit/ui/dialog_kkOptions.html index 808764e..a9f2ad4 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_kkOptions.html +++ b/docs/build/html/_modules/crikit/ui/dialog_kkOptions.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_kkOptions — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_kkOptions — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -182,19 +180,19 @@

    Source code for crikit.ui.dialog_kkOptions

     
     #    winDark = DialogDarkOptions.dialogDarkOptions(darkloaded=True)
     
    -    from crikit.data.hsi import Hsi as _Hsi
    +    from crikit.data.spectra import Hsi as _Hsi
     
         temp = _Hsi()
     
         WN = _np.linspace(500,4000,1000)
     
         CARS = _np.zeros((20,20,WN.size))
    -    CARS[:,:,:] = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
    +    CARS[:,:,:] = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
         temp.data = CARS
         temp.freq.data = WN
     
     
    -    NRB = 0*WN + .055
    +    NRB = 0*WN + .055
     
     
         winKK = DialogKKOptions.dialogKKOptions(data=[WN, NRB,
    @@ -215,7 +213,7 @@ 

    Source code for crikit.ui.dialog_kkOptions

       

    Quick search

    @@ -234,14 +232,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_model.html b/docs/build/html/_modules/crikit/ui/dialog_model.html index d80a500..4e57a45 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_model.html +++ b/docs/build/html/_modules/crikit/ui/dialog_model.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_model — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_model — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -166,7 +164,7 @@

    Source code for crikit.ui.dialog_model

       

    Quick search

    @@ -185,14 +183,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_ploteffect.html b/docs/build/html/_modules/crikit/ui/dialog_ploteffect.html index 15b5a74..5315d88 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_ploteffect.html +++ b/docs/build/html/_modules/crikit/ui/dialog_ploteffect.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_ploteffect — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_ploteffect — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -181,7 +179,7 @@

    Source code for crikit.ui.dialog_ploteffect

             self.plot_labels()
             try:
                 canvas.fig.tight_layout()
    -        except:
    +        except Exception:
                 print('Tight layout failed (dialog_ploteffect')
    @@ -314,7 +312,7 @@

    Source code for crikit.ui.dialog_ploteffect

             """
             If return list, [0] goes to original, [1] goes to affected
             """
    -        return [0*data_in + .1, data_in + .1]
    + return [0*data_in + .1, data_in + .1]
    if __name__ == '__main__': @@ -348,8 +346,8 @@

    Source code for crikit.ui.dialog_ploteffect

         # wl = calib_dict['a_vec'][0]*pix + calib_dict['a_vec'][1]
         # WN = .01/(wl*1e-9) - .01/(calib_dict['probe']*1e-9)
         
    -    CARS = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
    -    NRB = 0*WN + .055
    +    CARS = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
    +    NRB = 0*WN + .055
         CARS = _np.dot(_np.arange(1,4)[:,None],CARS[None,:])
         
         
    @@ -461,7 +459,7 @@ 

    Source code for crikit.ui.dialog_ploteffect

       

    Quick search

    @@ -480,14 +478,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_save.html b/docs/build/html/_modules/crikit/ui/dialog_save.html index 87a7b9c..fe676f0 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_save.html +++ b/docs/build/html/_modules/crikit/ui/dialog_save.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_save — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_save — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -305,7 +303,7 @@

    Source code for crikit.ui.dialog_save

       

    Quick search

    @@ -324,14 +322,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_subResidualOptions.html b/docs/build/html/_modules/crikit/ui/dialog_subResidualOptions.html index 0862557..3f731d6 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_subResidualOptions.html +++ b/docs/build/html/_modules/crikit/ui/dialog_subResidualOptions.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_subResidualOptions — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_subResidualOptions — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -147,7 +145,7 @@

    Source code for crikit.ui.dialog_subResidualOptions

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/dialog_varstabAnscombeOptions.html b/docs/build/html/_modules/crikit/ui/dialog_varstabAnscombeOptions.html index 962af01..7bdfeb2 100644 --- a/docs/build/html/_modules/crikit/ui/dialog_varstabAnscombeOptions.html +++ b/docs/build/html/_modules/crikit/ui/dialog_varstabAnscombeOptions.html @@ -5,15 +5,13 @@ - crikit.ui.dialog_varstabAnscombeOptions — CRIKit2 0.4.1 documentation - - - + crikit.ui.dialog_varstabAnscombeOptions — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -125,7 +123,7 @@

    Source code for crikit.ui.dialog_varstabAnscombeOptions

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/helper_plotOptions.html b/docs/build/html/_modules/crikit/ui/helper_plotOptions.html index 4144554..96c16ae 100644 --- a/docs/build/html/_modules/crikit/ui/helper_plotOptions.html +++ b/docs/build/html/_modules/crikit/ui/helper_plotOptions.html @@ -5,15 +5,13 @@ - crikit.ui.helper_plotOptions — CRIKit2 0.4.1 documentation - - - + crikit.ui.helper_plotOptions — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -51,10 +49,10 @@

    Source code for crikit.ui.helper_plotOptions

    COLOR_DICT = {'Blue':[0, 0, 1],
                       'Red':[1, 0, 0],
    -                  'Green':[0, .5, 0],
    -                  'Cyan':[0, .8, .8],
    +                  'Green':[0, .5, 0],
    +                  'Cyan':[0, .8, .8],
                       'Magenta':[1, 0, 1],
    -                  'Yellow':[.8, .8, 0]
    +                  'Yellow':[.8, .8, 0]
                       }
     
         COLOR_VEC = ['Blue', 'Green', 'Red', 'Magenta', 'Yellow', 'Cyan']
    @@ -165,7 +163,7 @@ 

    Source code for crikit.ui.helper_plotOptions

    Quick search
         
    @@ -184,14 +182,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/helper_roiselect.html b/docs/build/html/_modules/crikit/ui/helper_roiselect.html index 20cfa23..7183d79 100644 --- a/docs/build/html/_modules/crikit/ui/helper_roiselect.html +++ b/docs/build/html/_modules/crikit/ui/helper_roiselect.html @@ -5,15 +5,13 @@ - crikit.ui.helper_roiselect — CRIKit2 0.4.1 documentation - - - + crikit.ui.helper_roiselect — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -245,7 +243,7 @@

    Source code for crikit.ui.helper_roiselect

       

    Quick search

    @@ -264,14 +262,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/main_Mosaic.html b/docs/build/html/_modules/crikit/ui/main_Mosaic.html index 06e000f..e91baa4 100644 --- a/docs/build/html/_modules/crikit/ui/main_Mosaic.html +++ b/docs/build/html/_modules/crikit/ui/main_Mosaic.html @@ -5,15 +5,13 @@ - crikit.ui.main_Mosaic — CRIKit2 0.4.1 documentation - - - + crikit.ui.main_Mosaic — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -70,9 +68,9 @@

    Source code for crikit.ui.main_Mosaic

     
     from sciplot.ui.widget_mpl import MplCanvas as _MplCanvas
     
    -import lazy5
    -from lazy5.utils import FidOrFile, fullpath
    -from lazy5.ui.QtHdfLoad import HdfLoad
    +import crikit.io.lazy5 as lazy5
    +from crikit.io.lazy5.utils import FidOrFile, fullpath
    +from crikit.io.lazy5.ui.QtHdfLoad import HdfLoad
     
     
     
    [docs]class DnDReorderListWidget(_QListWidget): @@ -745,7 +743,7 @@

    Source code for crikit.ui.main_Mosaic

       

    Quick search

    @@ -764,14 +762,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/utils/check_requirements.html b/docs/build/html/_modules/crikit/ui/utils/check_requirements.html index 6f868b1..1884792 100644 --- a/docs/build/html/_modules/crikit/ui/utils/check_requirements.html +++ b/docs/build/html/_modules/crikit/ui/utils/check_requirements.html @@ -5,15 +5,13 @@ - crikit.ui.utils.check_requirements — CRIKit2 0.4.1 documentation - - - + crikit.ui.utils.check_requirements — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -56,8 +54,7 @@

    Source code for crikit.ui.utils.check_requirements

    'matplotlib':None, 'scipy':None, 'sciplot': '0.2.2', - 'cvxopt':None, - 'lazy5':'0.2.2'} + 'cvxopt':None} output = [] for r in requirement_dict: @@ -103,7 +100,7 @@

    Source code for crikit.ui.utils.check_requirements

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/utils/roi.html b/docs/build/html/_modules/crikit/ui/utils/roi.html index 596d26d..97d9b7a 100644 --- a/docs/build/html/_modules/crikit/ui/utils/roi.html +++ b/docs/build/html/_modules/crikit/ui/utils/roi.html @@ -5,15 +5,13 @@ - crikit.ui.utils.roi — CRIKit2 0.4.1 documentation - - - + crikit.ui.utils.roi — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -124,7 +122,7 @@

    Source code for crikit.ui.utils.roi

       

    Quick search

    @@ -143,14 +141,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_ALS.html b/docs/build/html/_modules/crikit/ui/widget_ALS.html index a778616..06f725f 100644 --- a/docs/build/html/_modules/crikit/ui/widget_ALS.html +++ b/docs/build/html/_modules/crikit/ui/widget_ALS.html @@ -5,15 +5,13 @@ - crikit.ui.widget_ALS — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_ALS — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -496,7 +494,7 @@

    Source code for crikit.ui.widget_ALS

       

    Quick search

    @@ -515,14 +513,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_ArPLS.html b/docs/build/html/_modules/crikit/ui/widget_ArPLS.html index f0283fd..e02d762 100644 --- a/docs/build/html/_modules/crikit/ui/widget_ArPLS.html +++ b/docs/build/html/_modules/crikit/ui/widget_ArPLS.html @@ -5,15 +5,13 @@ - crikit.ui.widget_ArPLS — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_ArPLS — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -249,7 +247,7 @@

    Source code for crikit.ui.widget_ArPLS

       

    Quick search

    @@ -268,14 +266,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_Calibrate.html b/docs/build/html/_modules/crikit/ui/widget_Calibrate.html index 0c95abc..3f66c2f 100644 --- a/docs/build/html/_modules/crikit/ui/widget_Calibrate.html +++ b/docs/build/html/_modules/crikit/ui/widget_Calibrate.html @@ -5,15 +5,13 @@ - crikit.ui.widget_Calibrate — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_Calibrate — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -238,10 +236,10 @@

    Source code for crikit.ui.widget_Calibrate

                       
         pix = _np.arange(calib_dict['n_pix'])
         wl = calib_dict['a_vec'][0]*pix + calib_dict['a_vec'][1]
    -    WN = .01/(wl*1e-9) - .01/(calib_dict['probe']*1e-9)
    +    WN = .01/(wl*1e-9) - .01/(calib_dict['probe']*1e-9)
         
    -    CARS = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
    -    NRB = 0*WN + .055
    +    CARS = _np.abs(1/(1000-WN-1j*20) + 1/(3000-WN-1j*20) + .055)
    +    NRB = 0*WN + .055
         CARS = _np.dot(_np.ones((5,1)),CARS[None,:])
     
             
    @@ -263,7 +261,7 @@ 

    Source code for crikit.ui.widget_Calibrate

       

    Quick search

    @@ -282,14 +280,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_Cut_every_n_spectra.html b/docs/build/html/_modules/crikit/ui/widget_Cut_every_n_spectra.html index a5a91fc..63f84ff 100644 --- a/docs/build/html/_modules/crikit/ui/widget_Cut_every_n_spectra.html +++ b/docs/build/html/_modules/crikit/ui/widget_Cut_every_n_spectra.html @@ -5,15 +5,13 @@ - crikit.ui.widget_Cut_every_n_spectra — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_Cut_every_n_spectra — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -213,7 +211,7 @@

    Source code for crikit.ui.widget_Cut_every_n_spectra

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_DeTrending.html b/docs/build/html/_modules/crikit/ui/widget_DeTrending.html index 6cabd3f..95dc9ff 100644 --- a/docs/build/html/_modules/crikit/ui/widget_DeTrending.html +++ b/docs/build/html/_modules/crikit/ui/widget_DeTrending.html @@ -5,15 +5,13 @@ - crikit.ui.widget_DeTrending — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_DeTrending — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -63,7 +61,7 @@

    Source code for crikit.ui.widget_DeTrending

     # Try to add arPLS to detrend options
     try:
         from crikit.ui.widget_ArPLS import widgetArPLS
    -except:
    +except Exception:
         pass
     else:
         _widget_list_names.append('ArPLS')
    @@ -112,13 +110,13 @@ 

    Source code for crikit.ui.widget_DeTrending

                     # to this container's version of the change-signal
                     try:
                         wdgt.changed.connect(self.widgetOptionsChanged)
    -                except:
    +                except Exception:
                         pass
                 else:
                     wdgt.setVisible(False)
                     try:
                         wdgt.changed.disconnect(self.widgetOptionsChanged)
    -                except:
    +                except Exception:
                         pass
                     
             # SIGNALS & SLOTS
    @@ -153,7 +151,7 @@ 

    Source code for crikit.ui.widget_DeTrending

                     # to this container's version of the change-signal
                     try:
                         wdgt.changed.connect(self.widgetOptionsChanged)
    -                except:
    +                except Exception:
                         pass
                 else:
                     wdgt.setVisible(False)
    @@ -161,7 +159,7 @@ 

    Source code for crikit.ui.widget_DeTrending

                     # Disconnect non-active widget's changed-signal
                     try:
                         wdgt.changed.disconnect(self.widgetOptionsChanged)
    -                except:
    +                except Exception:
                         pass
                     
             self.changed.emit()
    @@ -195,7 +193,7 @@

    Source code for crikit.ui.widget_DeTrending

       

    Quick search

    @@ -214,14 +212,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_Jupyter.html b/docs/build/html/_modules/crikit/ui/widget_Jupyter.html index 9d5b736..b0408c0 100644 --- a/docs/build/html/_modules/crikit/ui/widget_Jupyter.html +++ b/docs/build/html/_modules/crikit/ui/widget_Jupyter.html @@ -5,15 +5,13 @@ - crikit.ui.widget_Jupyter — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_Jupyter — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -150,7 +148,7 @@

    Source code for crikit.ui.widget_Jupyter

       

    Quick search

    @@ -169,14 +167,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_KK.html b/docs/build/html/_modules/crikit/ui/widget_KK.html index 2ecbf87..9cda833 100644 --- a/docs/build/html/_modules/crikit/ui/widget_KK.html +++ b/docs/build/html/_modules/crikit/ui/widget_KK.html @@ -5,15 +5,13 @@ - crikit.ui.widget_KK — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_KK — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -176,7 +174,7 @@

    Source code for crikit.ui.widget_KK

             nrb = data_in[0]
             cars = data_in[1]
             
    -        data_out = _np.zeros(cars.shape, dtype=_np.complex)
    +        data_out = _np.zeros(cars.shape, dtype=complex)
                    
             cars_amp_offset = self.parameters['cars_amp_offset']
             nrb_amp_offset = self.parameters['nrb_amp_offset'] 
    @@ -281,7 +279,7 @@ 

    Source code for crikit.ui.widget_KK

       

    Quick search

    @@ -300,14 +298,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_SG.html b/docs/build/html/_modules/crikit/ui/widget_SG.html index 735917f..4b26f76 100644 --- a/docs/build/html/_modules/crikit/ui/widget_SG.html +++ b/docs/build/html/_modules/crikit/ui/widget_SG.html @@ -5,15 +5,13 @@ - crikit.ui.widget_SG — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_SG — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -178,7 +176,7 @@

    Source code for crikit.ui.widget_SG

       

    Quick search

    @@ -197,14 +195,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_images.html b/docs/build/html/_modules/crikit/ui/widget_images.html index 3f6d308..780d950 100644 --- a/docs/build/html/_modules/crikit/ui/widget_images.html +++ b/docs/build/html/_modules/crikit/ui/widget_images.html @@ -5,15 +5,13 @@ - crikit.ui.widget_images — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_images — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -286,7 +284,7 @@

    Source code for crikit.ui.widget_images

                            cmap=self.colormode.ui.comboBoxColormap.currentText())
             try:
                 self.mpl.fig.tight_layout()
    -        except:
    +        except Exception:
                 print('tight_layout failed (widget_images 1')
     
             # Insert canvas widget into this widget
    @@ -377,7 +375,7 @@ 

    Source code for crikit.ui.widget_images

                                cmap=self.colormode.ui.comboBoxColormap.currentText())
                 self.mpl.draw()
     
    -        except:
    +        except Exception:
                 print('Error in spinBoxMinMaxSet')
    [docs] def checkBoxRemOutliers(self): @@ -420,7 +418,7 @@

    Source code for crikit.ui.widget_images

                         self.data.compress_low = False
                     else:
                         self.data.compress_low = True
    -            except:
    +            except Exception:
                     pass
             else:
                 self.data.setmin = None
    @@ -496,7 +494,7 @@ 

    Source code for crikit.ui.widget_images

             self.popimage.ui.pushButtonGSPop.setVisible(True)
             try:
                 self.popimage.ui.pushButtonPop.pressed.disconnect()
    -        except:
    +        except Exception:
                 pass
             self.popimage.ui.pushButtonPop.pressed.connect(lambda: self.createImg_Ext(img = self.data.image,
                                                                                       showcbar=False,
    @@ -610,7 +608,7 @@ 

    Source code for crikit.ui.widget_images

                                   extent = winextent)
             try:
                 self.mpl.fig.tight_layout()
    -        except:
    +        except Exception:
                 print('tight_layout failed (widget_image: 3')
     
             # Insert mpl widget into this widget
    @@ -699,7 +697,7 @@ 

    Source code for crikit.ui.widget_images

                                   extent = self.data.winextent)
             try:
                 self.mpl.fig.tight_layout()
    -        except:
    +        except Exception:
                 print('tight_layout failed (widget_image: 3')
             self.mpl.draw()
    @@ -746,7 +744,7 @@

    Source code for crikit.ui.widget_images

       

    Quick search

    @@ -765,14 +763,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_mergeNRBs.html b/docs/build/html/_modules/crikit/ui/widget_mergeNRBs.html index 923fc7e..6758701 100644 --- a/docs/build/html/_modules/crikit/ui/widget_mergeNRBs.html +++ b/docs/build/html/_modules/crikit/ui/widget_mergeNRBs.html @@ -5,15 +5,13 @@ - crikit.ui.widget_mergeNRBs — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_mergeNRBs — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -149,8 +147,8 @@

    Source code for crikit.ui.widget_mergeNRBs

             low = self.rng[0]
             high = self.rng[1]
             
    -        if (_np.isclose(self.wn.min(), low, atol=.1) & 
    -            _np.isclose(self.wn.max(), high, atol=.1)):
    +        if (_np.isclose(self.wn.min(), low, atol=.1) & 
    +            _np.isclose(self.wn.max(), high, atol=.1)):
                 return True
             else:
                 return False
    @@ -196,12 +194,12 @@ 

    Source code for crikit.ui.widget_mergeNRBs

                                             left_side_scale=self.parameters['scale_left'])
             
             if self.fullRange:
    -            pix = _np.arange(self.wn.size, dtype=_np.integer)
    +            pix = _np.arange(self.wn.size, dtype=_np.int32)
                 
             else:
                 list_rng_pix = _find_nearest(self.wn, self.rng)[1]
                 pix = _np.arange(list_rng_pix[0],list_rng_pix[1]+1,
    -                             dtype=_np.integer)
    +                             dtype=_np.int32)
                 
             nrb_merged = inst_nrb_merge.calculate()
             kkd = _np.zeros(data_in.shape)
    @@ -245,7 +243,7 @@ 

    Source code for crikit.ui.widget_mergeNRBs

       

    Quick search

    @@ -264,14 +262,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/ui/widget_scientificspin.html b/docs/build/html/_modules/crikit/ui/widget_scientificspin.html index 3d38ac3..2fee4a1 100644 --- a/docs/build/html/_modules/crikit/ui/widget_scientificspin.html +++ b/docs/build/html/_modules/crikit/ui/widget_scientificspin.html @@ -5,15 +5,13 @@ - crikit.ui.widget_scientificspin — CRIKit2 0.4.1 documentation - - - + crikit.ui.widget_scientificspin — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -120,7 +118,7 @@

    Source code for crikit.ui.widget_scientificspin

    <

    Quick search

    @@ -139,14 +137,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/breadcrumb.html b/docs/build/html/_modules/crikit/utils/breadcrumb.html index b644196..661c399 100644 --- a/docs/build/html/_modules/crikit/utils/breadcrumb.html +++ b/docs/build/html/_modules/crikit/utils/breadcrumb.html @@ -5,15 +5,13 @@ - crikit.utils.breadcrumb — CRIKit2 0.4.1 documentation - - - + crikit.utils.breadcrumb — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -165,14 +163,14 @@

    Source code for crikit.utils.breadcrumb

                         #print(step[0])
                         temp = temp + '_' + step[0]
                 return temp
    -        except:
    +        except Exception:
                 return None
     
         # METHODS
     
    [docs] @staticmethod def backup_pickle(data, fname, addl_attr = None): """ - Dump current state of data (class of type crikit.data.spectrum or + Dump current state of data (class of type crikit.data.spectra or subclass)to pickle file (filename= fname). Can append additional attributes (addl_attr) to \ @@ -290,14 +288,14 @@

    Source code for crikit.utils.breadcrumb

         test = BCPre(offset=10)
         try:
             test.add_step('Test1')
    -    except:
    +    except Exception:
             print('Expected Error\n')
         else:
             print('Should have raised an error')
     
         try:
             test.add_step(['Test',1])
    -    except:
    +    except Exception:
             print('Expected Error\n')
         else:
             print('Should have raised an error')
    @@ -360,7 +358,7 @@ 

    Source code for crikit.utils.breadcrumb

       

    Quick search

    @@ -379,14 +377,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/general.html b/docs/build/html/_modules/crikit/utils/general.html index 337e298..5632480 100644 --- a/docs/build/html/_modules/crikit/utils/general.html +++ b/docs/build/html/_modules/crikit/utils/general.html @@ -5,15 +5,13 @@ - crikit.utils.general — CRIKit2 0.4.1 documentation - - - + crikit.utils.general — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -86,7 +84,7 @@

    Source code for crikit.utils.general

             shaper_out = list(y.shape)
             shaper_out[-1] += 2*pad_width
             y_pad = _np.zeros(shaper_out, dtype=y.dtype)
    -        window = _np.zeros(shaper_out[-1], dtype=_np.integer)
    +        window = _np.zeros(shaper_out[-1], dtype=_np.int32)
             
             y_pad[...,pad_width:shaper[-1]+pad_width] = 1*y
             window[pad_width:shaper[-1]+pad_width] = 1
    @@ -160,14 +158,14 @@ 

    Source code for crikit.utils.general

             
         """
         if pad_width == 0:  # No padding
    -        window = _np.ones((y.shape[axis]), dtype=_np.integer)
    +        window = _np.ones((y.shape[axis]), dtype=_np.int32)
             y_pad = y
         elif pad_width > 0:
             orig_shape = y.shape
             pad_shape = list(orig_shape)
             pad_shape[axis] += pad_width*2
             
    -        window = _np.zeros((pad_shape[axis]), dtype=_np.integer)
    +        window = _np.zeros((pad_shape[axis]), dtype=_np.int32)
             window[pad_width:-pad_width] = 1
             
             y_pad = _np.zeros(pad_shape, dtype=y.dtype)
    @@ -223,7 +221,7 @@ 

    Source code for crikit.utils.general

         return vec
    -
    [docs]def arange_nonzero(start, stop, dtype=_np.float): +
    [docs]def arange_nonzero(start, stop, dtype=float): """ Similar to numpy arange but only returns non-zero elements """ @@ -397,7 +395,7 @@

    Source code for crikit.utils.general

       

    Quick search

    @@ -416,14 +414,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/roi.html b/docs/build/html/_modules/crikit/utils/roi.html index 3521847..743f9ad 100644 --- a/docs/build/html/_modules/crikit/utils/roi.html +++ b/docs/build/html/_modules/crikit/utils/roi.html @@ -5,15 +5,13 @@ - crikit.utils.roi — CRIKit2 0.4.1 documentation - - - + crikit.utils.roi — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -119,7 +117,7 @@

    Source code for crikit.utils.roi

       

    Quick search

    @@ -138,14 +136,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/tests/test_breadcrumb.html b/docs/build/html/_modules/crikit/utils/tests/test_breadcrumb.html index fa597ae..fd9a1af 100644 --- a/docs/build/html/_modules/crikit/utils/tests/test_breadcrumb.html +++ b/docs/build/html/_modules/crikit/utils/tests/test_breadcrumb.html @@ -5,15 +5,13 @@ - crikit.utils.tests.test_breadcrumb — CRIKit2 0.4.1 documentation - - - + crikit.utils.tests.test_breadcrumb — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -88,7 +86,7 @@

    Source code for crikit.utils.tests.test_breadcrumb

    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/tests/test_general.html b/docs/build/html/_modules/crikit/utils/tests/test_general.html index f135f68..b8b70f3 100644 --- a/docs/build/html/_modules/crikit/utils/tests/test_general.html +++ b/docs/build/html/_modules/crikit/utils/tests/test_general.html @@ -5,15 +5,13 @@ - crikit.utils.tests.test_general — CRIKit2 0.4.1 documentation - - - + crikit.utils.tests.test_general — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -180,7 +178,7 @@

    Source code for crikit.utils.tests.test_general

    <

    Quick search

    @@ -199,14 +197,14 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_modules/crikit/utils/tests/test_pad_edge_mean.html b/docs/build/html/_modules/crikit/utils/tests/test_pad_edge_mean.html index 2cf8995..d02c82f 100644 --- a/docs/build/html/_modules/crikit/utils/tests/test_pad_edge_mean.html +++ b/docs/build/html/_modules/crikit/utils/tests/test_pad_edge_mean.html @@ -5,15 +5,13 @@ - crikit.utils.tests.test_pad_edge_mean — CRIKit2 0.4.1 documentation - - - + crikit.utils.tests.test_pad_edge_mean — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - + @@ -116,7 +114,7 @@

    Source code for crikit.utils.tests.test_pad_edge_mean

    \ No newline at end of file diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html index 4cdfb1d..69bce40 100644 --- a/docs/build/html/_modules/index.html +++ b/docs/build/html/_modules/index.html @@ -5,15 +5,13 @@ - Overview: module code — CRIKit2 0.4.1 documentation - - - + Overview: module code — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +24,7 @@

    Navigation

  • modules |
  • - +
    @@ -51,11 +49,9 @@

    All modules for which code is available

  • crikit.cri.tests.test_sec
  • crikit.data.factorized
  • crikit.data.frequency
  • -
  • crikit.data.hsi
  • crikit.data.mosaic
  • crikit.data.replicate
  • crikit.data.spectra
  • -
  • crikit.data.spectrum
  • crikit.data.tests.test_hsi
  • crikit.data.tests.test_mosaic
  • crikit.data.tests.test_mosaic_hdf
  • @@ -64,6 +60,20 @@

    All modules for which code is available

  • crikit.datasets.model
  • crikit.io.csv_nist
  • crikit.io.hdf5
  • +
  • crikit.io.lazy5.alter
  • +
  • crikit.io.lazy5.config
  • +
  • crikit.io.lazy5.create
  • +
  • crikit.io.lazy5.inspect
  • +
  • crikit.io.lazy5.nonh5utils
  • +
  • crikit.io.lazy5.tests.test_alter
  • +
  • crikit.io.lazy5.tests.test_create
  • +
  • crikit.io.lazy5.tests.test_inspect
  • +
  • crikit.io.lazy5.tests.test_nonh5utils
  • +
  • crikit.io.lazy5.tests.test_ui
  • +
  • crikit.io.lazy5.tests.test_utils
  • +
  • crikit.io.lazy5.ui.QtHdfLoad
  • +
  • crikit.io.lazy5.ui.qt_HdfLoad
  • +
  • crikit.io.lazy5.utils
  • crikit.io.macros
  • crikit.io.meta_configs
  • crikit.io.meta_process
  • @@ -134,7 +144,7 @@

    All modules for which code is available

    Quick search

    @@ -153,13 +163,13 @@

    Navigation

  • modules |
  • - +
    \ No newline at end of file diff --git a/docs/build/html/_sources/crikit.data.rst.txt b/docs/build/html/_sources/crikit.data.rst.txt index c4ebb65..39179e8 100644 --- a/docs/build/html/_sources/crikit.data.rst.txt +++ b/docs/build/html/_sources/crikit.data.rst.txt @@ -28,14 +28,6 @@ crikit.data.frequency module :undoc-members: :show-inheritance: -crikit.data.hsi module ----------------------- - -.. automodule:: crikit.data.hsi - :members: - :undoc-members: - :show-inheritance: - crikit.data.mosaic module ------------------------- @@ -60,14 +52,6 @@ crikit.data.spectra module :undoc-members: :show-inheritance: -crikit.data.spectrum module ---------------------------- - -.. automodule:: crikit.data.spectrum - :members: - :undoc-members: - :show-inheritance: - Module contents --------------- diff --git a/docs/build/html/_sources/crikit.io.lazy5.rst.txt b/docs/build/html/_sources/crikit.io.lazy5.rst.txt new file mode 100644 index 0000000..f50b332 --- /dev/null +++ b/docs/build/html/_sources/crikit.io.lazy5.rst.txt @@ -0,0 +1,70 @@ +crikit.io.lazy5 package +======================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit.io.lazy5.tests + crikit.io.lazy5.ui + +Submodules +---------- + +crikit.io.lazy5.alter module +---------------------------- + +.. automodule:: crikit.io.lazy5.alter + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.config module +----------------------------- + +.. automodule:: crikit.io.lazy5.config + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.create module +----------------------------- + +.. automodule:: crikit.io.lazy5.create + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.inspect module +------------------------------ + +.. automodule:: crikit.io.lazy5.inspect + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.nonh5utils module +--------------------------------- + +.. automodule:: crikit.io.lazy5.nonh5utils + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.utils module +---------------------------- + +.. automodule:: crikit.io.lazy5.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5 + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/crikit.io.lazy5.tests.rst.txt b/docs/build/html/_sources/crikit.io.lazy5.tests.rst.txt new file mode 100644 index 0000000..1b29cc8 --- /dev/null +++ b/docs/build/html/_sources/crikit.io.lazy5.tests.rst.txt @@ -0,0 +1,61 @@ +crikit.io.lazy5.tests package +============================= + +Submodules +---------- + +crikit.io.lazy5.tests.test\_alter module +---------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_alter + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_create module +----------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_create + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_inspect module +------------------------------------------ + +.. automodule:: crikit.io.lazy5.tests.test_inspect + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_nonh5utils module +--------------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_nonh5utils + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_ui module +------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_ui + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_utils module +---------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5.tests + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/crikit.io.lazy5.ui.rst.txt b/docs/build/html/_sources/crikit.io.lazy5.ui.rst.txt new file mode 100644 index 0000000..4828b93 --- /dev/null +++ b/docs/build/html/_sources/crikit.io.lazy5.ui.rst.txt @@ -0,0 +1,29 @@ +crikit.io.lazy5.ui package +========================== + +Submodules +---------- + +crikit.io.lazy5.ui.QtHdfLoad module +----------------------------------- + +.. automodule:: crikit.io.lazy5.ui.QtHdfLoad + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.ui.qt\_HdfLoad module +------------------------------------- + +.. automodule:: crikit.io.lazy5.ui.qt_HdfLoad + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5.ui + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/build/html/_sources/crikit.io.rst.txt b/docs/build/html/_sources/crikit.io.rst.txt index c4f9734..c2765b7 100644 --- a/docs/build/html/_sources/crikit.io.rst.txt +++ b/docs/build/html/_sources/crikit.io.rst.txt @@ -7,6 +7,7 @@ Subpackages .. toctree:: :maxdepth: 4 + crikit.io.lazy5 crikit.io.tests Submodules diff --git a/docs/build/html/_sources/index.rst.txt b/docs/build/html/_sources/index.rst.txt index 15544f5..7f24a21 100644 --- a/docs/build/html/_sources/index.rst.txt +++ b/docs/build/html/_sources/index.rst.txt @@ -74,7 +74,6 @@ packages may work. - NumPy - PyQT5 - CVXOPT -- LazyHDF5 >= 0.2.2 - Requires H5Py (>= 2.6) diff --git a/docs/build/html/_sources/installing.rst.txt b/docs/build/html/_sources/installing.rst.txt index c2ff9bf..e97584f 100644 --- a/docs/build/html/_sources/installing.rst.txt +++ b/docs/build/html/_sources/installing.rst.txt @@ -29,7 +29,6 @@ packages may work. - PyQT5 - CVXOPT -- LazyHDF5 >= 0.2.2 - Requires H5Py (>= 2.6) diff --git a/docs/build/html/_static/basic.css b/docs/build/html/_static/basic.css index 24bc73e..bf18350 100644 --- a/docs/build/html/_static/basic.css +++ b/docs/build/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -130,7 +130,7 @@ ul.search li a { font-weight: bold; } -ul.search li div.context { +ul.search li p.context { color: #888; margin: 2px 0 0 30px; text-align: left; @@ -277,25 +277,25 @@ p.rubric { font-weight: bold; } -img.align-left, .figure.align-left, object.align-left { +img.align-left, figure.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } -img.align-right, .figure.align-right, object.align-right { +img.align-right, figure.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } -img.align-center, .figure.align-center, object.align-center { +img.align-center, figure.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } -img.align-default, .figure.align-default { +img.align-default, figure.align-default, .figure.align-default { display: block; margin-left: auto; margin-right: auto; @@ -319,7 +319,8 @@ img.align-default, .figure.align-default { /* -- sidebars -------------------------------------------------------------- */ -div.sidebar { +div.sidebar, +aside.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px; @@ -377,12 +378,14 @@ div.body p.centered { /* -- content of sidebars/topics/admonitions -------------------------------- */ div.sidebar > :last-child, +aside.sidebar > :last-child, div.topic > :last-child, div.admonition > :last-child { margin-bottom: 0; } div.sidebar::after, +aside.sidebar::after, div.topic::after, div.admonition::after, blockquote::after { @@ -455,20 +458,22 @@ td > :last-child { /* -- figures --------------------------------------------------------------- */ -div.figure { +div.figure, figure { margin: 0.5em; padding: 0.5em; } -div.figure p.caption { +div.figure p.caption, figcaption { padding: 0.3em; } -div.figure p.caption span.caption-number { +div.figure p.caption span.caption-number, +figcaption span.caption-number { font-style: italic; } -div.figure p.caption span.caption-text { +div.figure p.caption span.caption-text, +figcaption span.caption-text { } /* -- field list styles ----------------------------------------------------- */ @@ -503,6 +508,63 @@ table.hlist td { vertical-align: top; } +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + /* -- other body styles ----------------------------------------------------- */ @@ -629,14 +691,6 @@ dl.glossary dt { font-size: 1.1em; } -.optional { - font-size: 1.3em; -} - -.sig-paren { - font-size: larger; -} - .versionmodified { font-style: italic; } @@ -677,8 +731,9 @@ dl.glossary dt { .classifier:before { font-style: normal; - margin: 0.5em; + margin: 0 0.5em; content: ":"; + display: inline-block; } abbr, acronym { @@ -702,6 +757,7 @@ span.pre { -ms-hyphens: none; -webkit-hyphens: none; hyphens: none; + white-space: nowrap; } div[class*="highlight-"] { @@ -764,8 +820,13 @@ div.code-block-caption code { } table.highlighttable td.linenos, -div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */ - user-select: none; +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ } div.code-block-caption span.caption-number { @@ -780,16 +841,6 @@ div.literal-block-wrapper { margin: 1em 0; } -code.descname { - background-color: transparent; - font-weight: bold; - font-size: 1.2em; -} - -code.descclassname { - background-color: transparent; -} - code.xref, a code { background-color: transparent; font-weight: bold; diff --git a/docs/build/html/_static/doctools.js b/docs/build/html/_static/doctools.js index daccd20..e509e48 100644 --- a/docs/build/html/_static/doctools.js +++ b/docs/build/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -29,9 +29,14 @@ if (!window.console || !console.firebug) { /** * small helper function to urldecode strings + * + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL */ jQuery.urldecode = function(x) { - return decodeURIComponent(x).replace(/\+/g, ' '); + if (!x) { + return x + } + return decodeURIComponent(x.replace(/\+/g, ' ')); }; /** @@ -259,6 +264,9 @@ var Documentation = { hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); + var url = new URL(window.location); + url.searchParams.delete('highlight'); + window.history.replaceState({}, '', url); }, /** @@ -285,9 +293,10 @@ var Documentation = { initOnKeyListeners: function() { $(document).keydown(function(event) { var activeElementType = document.activeElement.tagName; - // don't navigate when in search box or textarea + // don't navigate when in search box, textarea, dropdown or button if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' - && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { + && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey + && !event.shiftKey) { switch (event.keyCode) { case 37: // left var prevHref = $('link[rel="prev"]').prop('href'); @@ -295,12 +304,14 @@ var Documentation = { window.location.href = prevHref; return false; } + break; case 39: // right var nextHref = $('link[rel="next"]').prop('href'); if (nextHref) { window.location.href = nextHref; return false; } + break; } } }); diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js index e9b7668..9bf3360 100644 --- a/docs/build/html/_static/documentation_options.js +++ b/docs/build/html/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.4.1', + VERSION: '0.4.3', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/build/html/_static/language_data.js b/docs/build/html/_static/language_data.js index d2b4ee9..ebe2f03 100644 --- a/docs/build/html/_static/language_data.js +++ b/docs/build/html/_static/language_data.js @@ -5,7 +5,7 @@ * This script contains the language-specific data used by searchtools.js, * namely the list of stopwords, stemmer, scorer and splitter. * - * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -13,7 +13,8 @@ var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]; -/* Non-minified version JS is _stemmer.js if file is provided */ +/* Non-minified version is copied as a separate JS file, is available */ + /** * Porter Stemmer */ @@ -199,7 +200,6 @@ var Stemmer = function() { - var splitChars = (function() { var result = {}; var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, diff --git a/docs/build/html/_static/nature.css b/docs/build/html/_static/nature.css index 32aade2..beb3a60 100644 --- a/docs/build/html/_static/nature.css +++ b/docs/build/html/_static/nature.css @@ -4,15 +4,15 @@ * * Sphinx stylesheet -- nature theme. * - * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ - + @import url("basic.css"); - + /* -- page layout ----------------------------------------------------------- */ - + body { font-family: Arial, sans-serif; font-size: 100%; @@ -34,18 +34,18 @@ div.bodywrapper { hr { border: 1px solid #B1B4B6; } - + div.document { background-color: #eee; } - + div.body { background-color: #ffffff; color: #3E4349; padding: 0 30px 30px 30px; font-size: 0.9em; } - + div.footer { color: #555; width: 100%; @@ -53,12 +53,12 @@ div.footer { text-align: center; font-size: 75%; } - + div.footer a { color: #444; text-decoration: underline; } - + div.related { background-color: #6BA81E; line-height: 32px; @@ -66,11 +66,11 @@ div.related { text-shadow: 0px 1px 0 #444; font-size: 0.9em; } - + div.related a { color: #E2F3CC; } - + div.sphinxsidebar { font-size: 0.75em; line-height: 1.5em; @@ -79,7 +79,7 @@ div.sphinxsidebar { div.sphinxsidebarwrapper{ padding: 20px 0; } - + div.sphinxsidebar h3, div.sphinxsidebar h4 { font-family: Arial, sans-serif; @@ -95,30 +95,30 @@ div.sphinxsidebar h4 { div.sphinxsidebar h4{ font-size: 1.1em; } - + div.sphinxsidebar h3 a { color: #444; } - - + + div.sphinxsidebar p { color: #888; padding: 5px 20px; } - + div.sphinxsidebar p.topless { } - + div.sphinxsidebar ul { margin: 10px 20px; padding: 0; color: #000; } - + div.sphinxsidebar a { color: #444; } - + div.sphinxsidebar input { border: 1px solid #ccc; font-family: sans-serif; @@ -131,17 +131,17 @@ div.sphinxsidebar .searchformwrapper { } /* -- body styles ----------------------------------------------------------- */ - + a { color: #005B81; text-decoration: none; } - + a:hover { color: #E32E00; text-decoration: underline; } - + div.body h1, div.body h2, div.body h3, @@ -156,30 +156,30 @@ div.body h6 { padding: 5px 0 5px 10px; text-shadow: 0px 1px 0 white } - + div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; } div.body h2 { font-size: 150%; background-color: #C8D5E3; } div.body h3 { font-size: 120%; background-color: #D8DEE3; } div.body h4 { font-size: 110%; background-color: #D8DEE3; } div.body h5 { font-size: 100%; background-color: #D8DEE3; } div.body h6 { font-size: 100%; background-color: #D8DEE3; } - + a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } - + a.headerlink:hover { background-color: #c60f0f; color: white; } - + div.body p, div.body dd, div.body li { line-height: 1.5em; } - + div.admonition p.admonition-title + p { display: inline; } @@ -188,29 +188,29 @@ div.note { background-color: #eee; border: 1px solid #ccc; } - + div.seealso { background-color: #ffc; border: 1px solid #ff6; } - + div.topic { background-color: #eee; } - + div.warning { background-color: #ffe4e4; border: 1px solid #f66; } - + p.admonition-title { display: inline; } - + p.admonition-title:after { content: ":"; } - + pre { padding: 10px; line-height: 1.2em; @@ -220,7 +220,7 @@ pre { -webkit-box-shadow: 1px 1px 1px #d8d8d8; -moz-box-shadow: 1px 1px 1px #d8d8d8; } - + code { background-color: #ecf0f3; color: #222; diff --git a/docs/build/html/_static/pygments.css b/docs/build/html/_static/pygments.css index 20c4814..691aeb8 100644 --- a/docs/build/html/_static/pygments.css +++ b/docs/build/html/_static/pygments.css @@ -1,5 +1,10 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } -.highlight { background: #eeffcc; } +.highlight { background: #eeffcc; } .highlight .c { color: #408090; font-style: italic } /* Comment */ .highlight .err { border: 1px solid #FF0000 } /* Error */ .highlight .k { color: #007020; font-weight: bold } /* Keyword */ diff --git a/docs/build/html/_static/searchtools.js b/docs/build/html/_static/searchtools.js index 970d0d9..2d77859 100644 --- a/docs/build/html/_static/searchtools.js +++ b/docs/build/html/_static/searchtools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for the full-text search. * - * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -59,10 +59,10 @@ var Search = { _pulse_status : -1, htmlToText : function(htmlString) { - var htmlElement = document.createElement('span'); - htmlElement.innerHTML = htmlString; - $(htmlElement).find('.headerlink').remove(); - docContent = $(htmlElement).find('[role=main]')[0]; + var virtualDocument = document.implementation.createHTMLDocument('virtual'); + var htmlElement = $(htmlString, virtualDocument); + htmlElement.find('.headerlink').remove(); + docContent = htmlElement.find('[role=main]')[0]; if(docContent === undefined) { console.warn("Content block not found. Sphinx search tries to obtain it " + "via '[role=main]'. Could you check your theme or template."); @@ -248,7 +248,7 @@ var Search = { // results left, load the summary and display it if (results.length) { var item = results.pop(); - var listItem = $('
  • '); + var listItem = $('
  • '); var requestUrl = ""; var linkUrl = ""; if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') { @@ -273,28 +273,31 @@ var Search = { if (item[3]) { listItem.append($(' (' + item[3] + ')')); Search.output.append(listItem); - listItem.slideDown(5, function() { + setTimeout(function() { displayNextItem(); - }); + }, 5); } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { $.ajax({url: requestUrl, dataType: "text", complete: function(jqxhr, textstatus) { var data = jqxhr.responseText; if (data !== '' && data !== undefined) { - listItem.append(Search.makeSearchSummary(data, searchterms, hlterms)); + var summary = Search.makeSearchSummary(data, searchterms, hlterms); + if (summary) { + listItem.append(summary); + } } Search.output.append(listItem); - listItem.slideDown(5, function() { + setTimeout(function() { displayNextItem(); - }); + }, 5); }}); } else { // no source available, just display title Search.output.append(listItem); - listItem.slideDown(5, function() { + setTimeout(function() { displayNextItem(); - }); + }, 5); } } // search finished, update title and status message @@ -325,7 +328,9 @@ var Search = { var results = []; for (var prefix in objects) { - for (var name in objects[prefix]) { + for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) { + var match = objects[prefix][iMatch]; + var name = match[4]; var fullname = (prefix ? prefix + '.' : '') + name; var fullnameLower = fullname.toLowerCase() if (fullnameLower.indexOf(object) > -1) { @@ -339,7 +344,6 @@ var Search = { } else if (parts[parts.length - 1].indexOf(object) > -1) { score += Scorer.objPartialMatch; } - var match = objects[prefix][name]; var objname = objnames[match[1]][2]; var title = titles[match[0]]; // If more than one term searched for, we require other words to be @@ -379,6 +383,13 @@ var Search = { return results; }, + /** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions + */ + escapeRegExp : function(string) { + return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string + }, + /** * search for full-text terms in the index */ @@ -402,13 +413,14 @@ var Search = { ]; // add support for partial matches if (word.length > 2) { + var word_regex = this.escapeRegExp(word); for (var w in terms) { - if (w.match(word) && !terms[word]) { + if (w.match(word_regex) && !terms[word]) { _o.push({files: terms[w], score: Scorer.partialTerm}) } } for (var w in titleterms) { - if (w.match(word) && !titleterms[word]) { + if (w.match(word_regex) && !titleterms[word]) { _o.push({files: titleterms[w], score: Scorer.partialTitle}) } } @@ -490,6 +502,9 @@ var Search = { */ makeSearchSummary : function(htmlText, keywords, hlwords) { var text = Search.htmlToText(htmlText); + if (text == "") { + return null; + } var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { @@ -501,7 +516,7 @@ var Search = { var excerpt = ((start > 0) ? '...' : '') + $.trim(text.substr(start, 240)) + ((start + 240 - text.length) ? '...' : ''); - var rv = $('
    ').text(excerpt); + var rv = $('

    ').text(excerpt); $.each(hlwords, function() { rv = rv.highlightText(this, 'highlighted'); }); diff --git a/docs/build/html/_static/underscore-1.13.1.js b/docs/build/html/_static/underscore-1.13.1.js new file mode 100644 index 0000000..ffd77af --- /dev/null +++ b/docs/build/html/_static/underscore-1.13.1.js @@ -0,0 +1,2042 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define('underscore', factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () { + var current = global._; + var exports = global._ = factory(); + exports.noConflict = function () { global._ = current; return exports; }; + }())); +}(this, (function () { + // Underscore.js 1.13.1 + // https://underscorejs.org + // (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors + // Underscore may be freely distributed under the MIT license. + + // Current version. + var VERSION = '1.13.1'; + + // Establish the root object, `window` (`self`) in the browser, `global` + // on the server, or `this` in some virtual machines. We use `self` + // instead of `window` for `WebWorker` support. + var root = typeof self == 'object' && self.self === self && self || + typeof global == 'object' && global.global === global && global || + Function('return this')() || + {}; + + // Save bytes in the minified (but not gzipped) version: + var ArrayProto = Array.prototype, ObjProto = Object.prototype; + var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null; + + // Create quick reference variables for speed access to core prototypes. + var push = ArrayProto.push, + slice = ArrayProto.slice, + toString = ObjProto.toString, + hasOwnProperty = ObjProto.hasOwnProperty; + + // Modern feature detection. + var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined', + supportsDataView = typeof DataView !== 'undefined'; + + // All **ECMAScript 5+** native function implementations that we hope to use + // are declared here. + var nativeIsArray = Array.isArray, + nativeKeys = Object.keys, + nativeCreate = Object.create, + nativeIsView = supportsArrayBuffer && ArrayBuffer.isView; + + // Create references to these builtin functions because we override them. + var _isNaN = isNaN, + _isFinite = isFinite; + + // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. + var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); + var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', + 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; + + // The largest integer that can be represented exactly. + var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; + + // Some functions take a variable number of arguments, or a few expected + // arguments at the beginning and then a variable number of values to operate + // on. This helper accumulates all remaining arguments past the function’s + // argument length (or an explicit `startIndex`), into an array that becomes + // the last argument. Similar to ES6’s "rest parameter". + function restArguments(func, startIndex) { + startIndex = startIndex == null ? func.length - 1 : +startIndex; + return function() { + var length = Math.max(arguments.length - startIndex, 0), + rest = Array(length), + index = 0; + for (; index < length; index++) { + rest[index] = arguments[index + startIndex]; + } + switch (startIndex) { + case 0: return func.call(this, rest); + case 1: return func.call(this, arguments[0], rest); + case 2: return func.call(this, arguments[0], arguments[1], rest); + } + var args = Array(startIndex + 1); + for (index = 0; index < startIndex; index++) { + args[index] = arguments[index]; + } + args[startIndex] = rest; + return func.apply(this, args); + }; + } + + // Is a given variable an object? + function isObject(obj) { + var type = typeof obj; + return type === 'function' || type === 'object' && !!obj; + } + + // Is a given value equal to null? + function isNull(obj) { + return obj === null; + } + + // Is a given variable undefined? + function isUndefined(obj) { + return obj === void 0; + } + + // Is a given value a boolean? + function isBoolean(obj) { + return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; + } + + // Is a given value a DOM element? + function isElement(obj) { + return !!(obj && obj.nodeType === 1); + } + + // Internal function for creating a `toString`-based type tester. + function tagTester(name) { + var tag = '[object ' + name + ']'; + return function(obj) { + return toString.call(obj) === tag; + }; + } + + var isString = tagTester('String'); + + var isNumber = tagTester('Number'); + + var isDate = tagTester('Date'); + + var isRegExp = tagTester('RegExp'); + + var isError = tagTester('Error'); + + var isSymbol = tagTester('Symbol'); + + var isArrayBuffer = tagTester('ArrayBuffer'); + + var isFunction = tagTester('Function'); + + // Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old + // v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236). + var nodelist = root.document && root.document.childNodes; + if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') { + isFunction = function(obj) { + return typeof obj == 'function' || false; + }; + } + + var isFunction$1 = isFunction; + + var hasObjectTag = tagTester('Object'); + + // In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`. + // In IE 11, the most common among them, this problem also applies to + // `Map`, `WeakMap` and `Set`. + var hasStringTagBug = ( + supportsDataView && hasObjectTag(new DataView(new ArrayBuffer(8))) + ), + isIE11 = (typeof Map !== 'undefined' && hasObjectTag(new Map)); + + var isDataView = tagTester('DataView'); + + // In IE 10 - Edge 13, we need a different heuristic + // to determine whether an object is a `DataView`. + function ie10IsDataView(obj) { + return obj != null && isFunction$1(obj.getInt8) && isArrayBuffer(obj.buffer); + } + + var isDataView$1 = (hasStringTagBug ? ie10IsDataView : isDataView); + + // Is a given value an array? + // Delegates to ECMA5's native `Array.isArray`. + var isArray = nativeIsArray || tagTester('Array'); + + // Internal function to check whether `key` is an own property name of `obj`. + function has$1(obj, key) { + return obj != null && hasOwnProperty.call(obj, key); + } + + var isArguments = tagTester('Arguments'); + + // Define a fallback version of the method in browsers (ahem, IE < 9), where + // there isn't any inspectable "Arguments" type. + (function() { + if (!isArguments(arguments)) { + isArguments = function(obj) { + return has$1(obj, 'callee'); + }; + } + }()); + + var isArguments$1 = isArguments; + + // Is a given object a finite number? + function isFinite$1(obj) { + return !isSymbol(obj) && _isFinite(obj) && !isNaN(parseFloat(obj)); + } + + // Is the given value `NaN`? + function isNaN$1(obj) { + return isNumber(obj) && _isNaN(obj); + } + + // Predicate-generating function. Often useful outside of Underscore. + function constant(value) { + return function() { + return value; + }; + } + + // Common internal logic for `isArrayLike` and `isBufferLike`. + function createSizePropertyCheck(getSizeProperty) { + return function(collection) { + var sizeProperty = getSizeProperty(collection); + return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX; + } + } + + // Internal helper to generate a function to obtain property `key` from `obj`. + function shallowProperty(key) { + return function(obj) { + return obj == null ? void 0 : obj[key]; + }; + } + + // Internal helper to obtain the `byteLength` property of an object. + var getByteLength = shallowProperty('byteLength'); + + // Internal helper to determine whether we should spend extensive checks against + // `ArrayBuffer` et al. + var isBufferLike = createSizePropertyCheck(getByteLength); + + // Is a given value a typed array? + var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/; + function isTypedArray(obj) { + // `ArrayBuffer.isView` is the most future-proof, so use it when available. + // Otherwise, fall back on the above regular expression. + return nativeIsView ? (nativeIsView(obj) && !isDataView$1(obj)) : + isBufferLike(obj) && typedArrayPattern.test(toString.call(obj)); + } + + var isTypedArray$1 = supportsArrayBuffer ? isTypedArray : constant(false); + + // Internal helper to obtain the `length` property of an object. + var getLength = shallowProperty('length'); + + // Internal helper to create a simple lookup structure. + // `collectNonEnumProps` used to depend on `_.contains`, but this led to + // circular imports. `emulatedSet` is a one-off solution that only works for + // arrays of strings. + function emulatedSet(keys) { + var hash = {}; + for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true; + return { + contains: function(key) { return hash[key]; }, + push: function(key) { + hash[key] = true; + return keys.push(key); + } + }; + } + + // Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't + // be iterated by `for key in ...` and thus missed. Extends `keys` in place if + // needed. + function collectNonEnumProps(obj, keys) { + keys = emulatedSet(keys); + var nonEnumIdx = nonEnumerableProps.length; + var constructor = obj.constructor; + var proto = isFunction$1(constructor) && constructor.prototype || ObjProto; + + // Constructor is a special case. + var prop = 'constructor'; + if (has$1(obj, prop) && !keys.contains(prop)) keys.push(prop); + + while (nonEnumIdx--) { + prop = nonEnumerableProps[nonEnumIdx]; + if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) { + keys.push(prop); + } + } + } + + // Retrieve the names of an object's own properties. + // Delegates to **ECMAScript 5**'s native `Object.keys`. + function keys(obj) { + if (!isObject(obj)) return []; + if (nativeKeys) return nativeKeys(obj); + var keys = []; + for (var key in obj) if (has$1(obj, key)) keys.push(key); + // Ahem, IE < 9. + if (hasEnumBug) collectNonEnumProps(obj, keys); + return keys; + } + + // Is a given array, string, or object empty? + // An "empty" object has no enumerable own-properties. + function isEmpty(obj) { + if (obj == null) return true; + // Skip the more expensive `toString`-based type checks if `obj` has no + // `.length`. + var length = getLength(obj); + if (typeof length == 'number' && ( + isArray(obj) || isString(obj) || isArguments$1(obj) + )) return length === 0; + return getLength(keys(obj)) === 0; + } + + // Returns whether an object has a given set of `key:value` pairs. + function isMatch(object, attrs) { + var _keys = keys(attrs), length = _keys.length; + if (object == null) return !length; + var obj = Object(object); + for (var i = 0; i < length; i++) { + var key = _keys[i]; + if (attrs[key] !== obj[key] || !(key in obj)) return false; + } + return true; + } + + // If Underscore is called as a function, it returns a wrapped object that can + // be used OO-style. This wrapper holds altered versions of all functions added + // through `_.mixin`. Wrapped objects may be chained. + function _$1(obj) { + if (obj instanceof _$1) return obj; + if (!(this instanceof _$1)) return new _$1(obj); + this._wrapped = obj; + } + + _$1.VERSION = VERSION; + + // Extracts the result from a wrapped and chained object. + _$1.prototype.value = function() { + return this._wrapped; + }; + + // Provide unwrapping proxies for some methods used in engine operations + // such as arithmetic and JSON stringification. + _$1.prototype.valueOf = _$1.prototype.toJSON = _$1.prototype.value; + + _$1.prototype.toString = function() { + return String(this._wrapped); + }; + + // Internal function to wrap or shallow-copy an ArrayBuffer, + // typed array or DataView to a new view, reusing the buffer. + function toBufferView(bufferSource) { + return new Uint8Array( + bufferSource.buffer || bufferSource, + bufferSource.byteOffset || 0, + getByteLength(bufferSource) + ); + } + + // We use this string twice, so give it a name for minification. + var tagDataView = '[object DataView]'; + + // Internal recursive comparison function for `_.isEqual`. + function eq(a, b, aStack, bStack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal). + if (a === b) return a !== 0 || 1 / a === 1 / b; + // `null` or `undefined` only equal to itself (strict comparison). + if (a == null || b == null) return false; + // `NaN`s are equivalent, but non-reflexive. + if (a !== a) return b !== b; + // Exhaust primitive checks + var type = typeof a; + if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; + return deepEq(a, b, aStack, bStack); + } + + // Internal recursive comparison function for `_.isEqual`. + function deepEq(a, b, aStack, bStack) { + // Unwrap any wrapped objects. + if (a instanceof _$1) a = a._wrapped; + if (b instanceof _$1) b = b._wrapped; + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className !== toString.call(b)) return false; + // Work around a bug in IE 10 - Edge 13. + if (hasStringTagBug && className == '[object Object]' && isDataView$1(a)) { + if (!isDataView$1(b)) return false; + className = tagDataView; + } + switch (className) { + // These types are compared by value. + case '[object RegExp]': + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case '[object String]': + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return '' + a === '' + b; + case '[object Number]': + // `NaN`s are equivalent, but non-reflexive. + // Object(NaN) is equivalent to NaN. + if (+a !== +a) return +b !== +b; + // An `egal` comparison is performed for other numeric values. + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case '[object Date]': + case '[object Boolean]': + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a === +b; + case '[object Symbol]': + return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); + case '[object ArrayBuffer]': + case tagDataView: + // Coerce to typed array so we can fall through. + return deepEq(toBufferView(a), toBufferView(b), aStack, bStack); + } + + var areArrays = className === '[object Array]'; + if (!areArrays && isTypedArray$1(a)) { + var byteLength = getByteLength(a); + if (byteLength !== getByteLength(b)) return false; + if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true; + areArrays = true; + } + if (!areArrays) { + if (typeof a != 'object' || typeof b != 'object') return false; + + // Objects with different constructors are not equivalent, but `Object`s or `Array`s + // from different frames are. + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor && + isFunction$1(bCtor) && bCtor instanceof bCtor) + && ('constructor' in a && 'constructor' in b)) { + return false; + } + } + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + + // Initializing stack of traversed objects. + // It's done here since we only need them for objects and arrays comparison. + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (aStack[length] === a) return bStack[length] === b; + } + + // Add the first object to the stack of traversed objects. + aStack.push(a); + bStack.push(b); + + // Recursively compare objects and arrays. + if (areArrays) { + // Compare array lengths to determine if a deep comparison is necessary. + length = a.length; + if (length !== b.length) return false; + // Deep compare the contents, ignoring non-numeric properties. + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) return false; + } + } else { + // Deep compare objects. + var _keys = keys(a), key; + length = _keys.length; + // Ensure that both objects contain the same number of properties before comparing deep equality. + if (keys(b).length !== length) return false; + while (length--) { + // Deep compare each member + key = _keys[length]; + if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack))) return false; + } + } + // Remove the first object from the stack of traversed objects. + aStack.pop(); + bStack.pop(); + return true; + } + + // Perform a deep comparison to check if two objects are equal. + function isEqual(a, b) { + return eq(a, b); + } + + // Retrieve all the enumerable property names of an object. + function allKeys(obj) { + if (!isObject(obj)) return []; + var keys = []; + for (var key in obj) keys.push(key); + // Ahem, IE < 9. + if (hasEnumBug) collectNonEnumProps(obj, keys); + return keys; + } + + // Since the regular `Object.prototype.toString` type tests don't work for + // some types in IE 11, we use a fingerprinting heuristic instead, based + // on the methods. It's not great, but it's the best we got. + // The fingerprint method lists are defined below. + function ie11fingerprint(methods) { + var length = getLength(methods); + return function(obj) { + if (obj == null) return false; + // `Map`, `WeakMap` and `Set` have no enumerable keys. + var keys = allKeys(obj); + if (getLength(keys)) return false; + for (var i = 0; i < length; i++) { + if (!isFunction$1(obj[methods[i]])) return false; + } + // If we are testing against `WeakMap`, we need to ensure that + // `obj` doesn't have a `forEach` method in order to distinguish + // it from a regular `Map`. + return methods !== weakMapMethods || !isFunction$1(obj[forEachName]); + }; + } + + // In the interest of compact minification, we write + // each string in the fingerprints only once. + var forEachName = 'forEach', + hasName = 'has', + commonInit = ['clear', 'delete'], + mapTail = ['get', hasName, 'set']; + + // `Map`, `WeakMap` and `Set` each have slightly different + // combinations of the above sublists. + var mapMethods = commonInit.concat(forEachName, mapTail), + weakMapMethods = commonInit.concat(mapTail), + setMethods = ['add'].concat(commonInit, forEachName, hasName); + + var isMap = isIE11 ? ie11fingerprint(mapMethods) : tagTester('Map'); + + var isWeakMap = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester('WeakMap'); + + var isSet = isIE11 ? ie11fingerprint(setMethods) : tagTester('Set'); + + var isWeakSet = tagTester('WeakSet'); + + // Retrieve the values of an object's properties. + function values(obj) { + var _keys = keys(obj); + var length = _keys.length; + var values = Array(length); + for (var i = 0; i < length; i++) { + values[i] = obj[_keys[i]]; + } + return values; + } + + // Convert an object into a list of `[key, value]` pairs. + // The opposite of `_.object` with one argument. + function pairs(obj) { + var _keys = keys(obj); + var length = _keys.length; + var pairs = Array(length); + for (var i = 0; i < length; i++) { + pairs[i] = [_keys[i], obj[_keys[i]]]; + } + return pairs; + } + + // Invert the keys and values of an object. The values must be serializable. + function invert(obj) { + var result = {}; + var _keys = keys(obj); + for (var i = 0, length = _keys.length; i < length; i++) { + result[obj[_keys[i]]] = _keys[i]; + } + return result; + } + + // Return a sorted list of the function names available on the object. + function functions(obj) { + var names = []; + for (var key in obj) { + if (isFunction$1(obj[key])) names.push(key); + } + return names.sort(); + } + + // An internal function for creating assigner functions. + function createAssigner(keysFunc, defaults) { + return function(obj) { + var length = arguments.length; + if (defaults) obj = Object(obj); + if (length < 2 || obj == null) return obj; + for (var index = 1; index < length; index++) { + var source = arguments[index], + keys = keysFunc(source), + l = keys.length; + for (var i = 0; i < l; i++) { + var key = keys[i]; + if (!defaults || obj[key] === void 0) obj[key] = source[key]; + } + } + return obj; + }; + } + + // Extend a given object with all the properties in passed-in object(s). + var extend = createAssigner(allKeys); + + // Assigns a given object with all the own properties in the passed-in + // object(s). + // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) + var extendOwn = createAssigner(keys); + + // Fill in a given object with default properties. + var defaults = createAssigner(allKeys, true); + + // Create a naked function reference for surrogate-prototype-swapping. + function ctor() { + return function(){}; + } + + // An internal function for creating a new object that inherits from another. + function baseCreate(prototype) { + if (!isObject(prototype)) return {}; + if (nativeCreate) return nativeCreate(prototype); + var Ctor = ctor(); + Ctor.prototype = prototype; + var result = new Ctor; + Ctor.prototype = null; + return result; + } + + // Creates an object that inherits from the given prototype object. + // If additional properties are provided then they will be added to the + // created object. + function create(prototype, props) { + var result = baseCreate(prototype); + if (props) extendOwn(result, props); + return result; + } + + // Create a (shallow-cloned) duplicate of an object. + function clone(obj) { + if (!isObject(obj)) return obj; + return isArray(obj) ? obj.slice() : extend({}, obj); + } + + // Invokes `interceptor` with the `obj` and then returns `obj`. + // The primary purpose of this method is to "tap into" a method chain, in + // order to perform operations on intermediate results within the chain. + function tap(obj, interceptor) { + interceptor(obj); + return obj; + } + + // Normalize a (deep) property `path` to array. + // Like `_.iteratee`, this function can be customized. + function toPath$1(path) { + return isArray(path) ? path : [path]; + } + _$1.toPath = toPath$1; + + // Internal wrapper for `_.toPath` to enable minification. + // Similar to `cb` for `_.iteratee`. + function toPath(path) { + return _$1.toPath(path); + } + + // Internal function to obtain a nested property in `obj` along `path`. + function deepGet(obj, path) { + var length = path.length; + for (var i = 0; i < length; i++) { + if (obj == null) return void 0; + obj = obj[path[i]]; + } + return length ? obj : void 0; + } + + // Get the value of the (deep) property on `path` from `object`. + // If any property in `path` does not exist or if the value is + // `undefined`, return `defaultValue` instead. + // The `path` is normalized through `_.toPath`. + function get(object, path, defaultValue) { + var value = deepGet(object, toPath(path)); + return isUndefined(value) ? defaultValue : value; + } + + // Shortcut function for checking if an object has a given property directly on + // itself (in other words, not on a prototype). Unlike the internal `has` + // function, this public version can also traverse nested properties. + function has(obj, path) { + path = toPath(path); + var length = path.length; + for (var i = 0; i < length; i++) { + var key = path[i]; + if (!has$1(obj, key)) return false; + obj = obj[key]; + } + return !!length; + } + + // Keep the identity function around for default iteratees. + function identity(value) { + return value; + } + + // Returns a predicate for checking whether an object has a given set of + // `key:value` pairs. + function matcher(attrs) { + attrs = extendOwn({}, attrs); + return function(obj) { + return isMatch(obj, attrs); + }; + } + + // Creates a function that, when passed an object, will traverse that object’s + // properties down the given `path`, specified as an array of keys or indices. + function property(path) { + path = toPath(path); + return function(obj) { + return deepGet(obj, path); + }; + } + + // Internal function that returns an efficient (for current engines) version + // of the passed-in callback, to be repeatedly applied in other Underscore + // functions. + function optimizeCb(func, context, argCount) { + if (context === void 0) return func; + switch (argCount == null ? 3 : argCount) { + case 1: return function(value) { + return func.call(context, value); + }; + // The 2-argument case is omitted because we’re not using it. + case 3: return function(value, index, collection) { + return func.call(context, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(context, accumulator, value, index, collection); + }; + } + return function() { + return func.apply(context, arguments); + }; + } + + // An internal function to generate callbacks that can be applied to each + // element in a collection, returning the desired result — either `_.identity`, + // an arbitrary callback, a property matcher, or a property accessor. + function baseIteratee(value, context, argCount) { + if (value == null) return identity; + if (isFunction$1(value)) return optimizeCb(value, context, argCount); + if (isObject(value) && !isArray(value)) return matcher(value); + return property(value); + } + + // External wrapper for our callback generator. Users may customize + // `_.iteratee` if they want additional predicate/iteratee shorthand styles. + // This abstraction hides the internal-only `argCount` argument. + function iteratee(value, context) { + return baseIteratee(value, context, Infinity); + } + _$1.iteratee = iteratee; + + // The function we call internally to generate a callback. It invokes + // `_.iteratee` if overridden, otherwise `baseIteratee`. + function cb(value, context, argCount) { + if (_$1.iteratee !== iteratee) return _$1.iteratee(value, context); + return baseIteratee(value, context, argCount); + } + + // Returns the results of applying the `iteratee` to each element of `obj`. + // In contrast to `_.map` it returns an object. + function mapObject(obj, iteratee, context) { + iteratee = cb(iteratee, context); + var _keys = keys(obj), + length = _keys.length, + results = {}; + for (var index = 0; index < length; index++) { + var currentKey = _keys[index]; + results[currentKey] = iteratee(obj[currentKey], currentKey, obj); + } + return results; + } + + // Predicate-generating function. Often useful outside of Underscore. + function noop(){} + + // Generates a function for a given object that returns a given property. + function propertyOf(obj) { + if (obj == null) return noop; + return function(path) { + return get(obj, path); + }; + } + + // Run a function **n** times. + function times(n, iteratee, context) { + var accum = Array(Math.max(0, n)); + iteratee = optimizeCb(iteratee, context, 1); + for (var i = 0; i < n; i++) accum[i] = iteratee(i); + return accum; + } + + // Return a random integer between `min` and `max` (inclusive). + function random(min, max) { + if (max == null) { + max = min; + min = 0; + } + return min + Math.floor(Math.random() * (max - min + 1)); + } + + // A (possibly faster) way to get the current timestamp as an integer. + var now = Date.now || function() { + return new Date().getTime(); + }; + + // Internal helper to generate functions for escaping and unescaping strings + // to/from HTML interpolation. + function createEscaper(map) { + var escaper = function(match) { + return map[match]; + }; + // Regexes for identifying a key that needs to be escaped. + var source = '(?:' + keys(map).join('|') + ')'; + var testRegexp = RegExp(source); + var replaceRegexp = RegExp(source, 'g'); + return function(string) { + string = string == null ? '' : '' + string; + return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; + }; + } + + // Internal list of HTML entities for escaping. + var escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`' + }; + + // Function for escaping strings to HTML interpolation. + var _escape = createEscaper(escapeMap); + + // Internal list of HTML entities for unescaping. + var unescapeMap = invert(escapeMap); + + // Function for unescaping strings from HTML interpolation. + var _unescape = createEscaper(unescapeMap); + + // By default, Underscore uses ERB-style template delimiters. Change the + // following template settings to use alternative delimiters. + var templateSettings = _$1.templateSettings = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g + }; + + // When customizing `_.templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /(.)^/; + + // Certain characters need to be escaped so that they can be put into a + // string literal. + var escapes = { + "'": "'", + '\\': '\\', + '\r': 'r', + '\n': 'n', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g; + + function escapeChar(match) { + return '\\' + escapes[match]; + } + + // In order to prevent third-party code injection through + // `_.templateSettings.variable`, we test it against the following regular + // expression. It is intentionally a bit more liberal than just matching valid + // identifiers, but still prevents possible loopholes through defaults or + // destructuring assignment. + var bareIdentifier = /^\s*(\w|\$)+\s*$/; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + // NB: `oldSettings` only exists for backwards compatibility. + function template(text, settings, oldSettings) { + if (!settings && oldSettings) settings = oldSettings; + settings = defaults({}, settings, _$1.templateSettings); + + // Combine delimiters into one regular expression via alternation. + var matcher = RegExp([ + (settings.escape || noMatch).source, + (settings.interpolate || noMatch).source, + (settings.evaluate || noMatch).source + ].join('|') + '|$', 'g'); + + // Compile the template source, escaping string literals appropriately. + var index = 0; + var source = "__p+='"; + text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { + source += text.slice(index, offset).replace(escapeRegExp, escapeChar); + index = offset + match.length; + + if (escape) { + source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; + } else if (interpolate) { + source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; + } else if (evaluate) { + source += "';\n" + evaluate + "\n__p+='"; + } + + // Adobe VMs need the match returned to produce the correct offset. + return match; + }); + source += "';\n"; + + var argument = settings.variable; + if (argument) { + // Insure against third-party code injection. (CVE-2021-23358) + if (!bareIdentifier.test(argument)) throw new Error( + 'variable is not a bare identifier: ' + argument + ); + } else { + // If a variable is not specified, place data values in local scope. + source = 'with(obj||{}){\n' + source + '}\n'; + argument = 'obj'; + } + + source = "var __t,__p='',__j=Array.prototype.join," + + "print=function(){__p+=__j.call(arguments,'');};\n" + + source + 'return __p;\n'; + + var render; + try { + render = new Function(argument, '_', source); + } catch (e) { + e.source = source; + throw e; + } + + var template = function(data) { + return render.call(this, data, _$1); + }; + + // Provide the compiled source as a convenience for precompilation. + template.source = 'function(' + argument + '){\n' + source + '}'; + + return template; + } + + // Traverses the children of `obj` along `path`. If a child is a function, it + // is invoked with its parent as context. Returns the value of the final + // child, or `fallback` if any child is undefined. + function result(obj, path, fallback) { + path = toPath(path); + var length = path.length; + if (!length) { + return isFunction$1(fallback) ? fallback.call(obj) : fallback; + } + for (var i = 0; i < length; i++) { + var prop = obj == null ? void 0 : obj[path[i]]; + if (prop === void 0) { + prop = fallback; + i = length; // Ensure we don't continue iterating. + } + obj = isFunction$1(prop) ? prop.call(obj) : prop; + } + return obj; + } + + // Generate a unique integer id (unique within the entire client session). + // Useful for temporary DOM ids. + var idCounter = 0; + function uniqueId(prefix) { + var id = ++idCounter + ''; + return prefix ? prefix + id : id; + } + + // Start chaining a wrapped Underscore object. + function chain(obj) { + var instance = _$1(obj); + instance._chain = true; + return instance; + } + + // Internal function to execute `sourceFunc` bound to `context` with optional + // `args`. Determines whether to execute a function as a constructor or as a + // normal function. + function executeBound(sourceFunc, boundFunc, context, callingContext, args) { + if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); + var self = baseCreate(sourceFunc.prototype); + var result = sourceFunc.apply(self, args); + if (isObject(result)) return result; + return self; + } + + // Partially apply a function by creating a version that has had some of its + // arguments pre-filled, without changing its dynamic `this` context. `_` acts + // as a placeholder by default, allowing any combination of arguments to be + // pre-filled. Set `_.partial.placeholder` for a custom placeholder argument. + var partial = restArguments(function(func, boundArgs) { + var placeholder = partial.placeholder; + var bound = function() { + var position = 0, length = boundArgs.length; + var args = Array(length); + for (var i = 0; i < length; i++) { + args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]; + } + while (position < arguments.length) args.push(arguments[position++]); + return executeBound(func, bound, this, this, args); + }; + return bound; + }); + + partial.placeholder = _$1; + + // Create a function bound to a given object (assigning `this`, and arguments, + // optionally). + var bind = restArguments(function(func, context, args) { + if (!isFunction$1(func)) throw new TypeError('Bind must be called on a function'); + var bound = restArguments(function(callArgs) { + return executeBound(func, bound, context, this, args.concat(callArgs)); + }); + return bound; + }); + + // Internal helper for collection methods to determine whether a collection + // should be iterated as an array or as an object. + // Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength + // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 + var isArrayLike = createSizePropertyCheck(getLength); + + // Internal implementation of a recursive `flatten` function. + function flatten$1(input, depth, strict, output) { + output = output || []; + if (!depth && depth !== 0) { + depth = Infinity; + } else if (depth <= 0) { + return output.concat(input); + } + var idx = output.length; + for (var i = 0, length = getLength(input); i < length; i++) { + var value = input[i]; + if (isArrayLike(value) && (isArray(value) || isArguments$1(value))) { + // Flatten current level of array or arguments object. + if (depth > 1) { + flatten$1(value, depth - 1, strict, output); + idx = output.length; + } else { + var j = 0, len = value.length; + while (j < len) output[idx++] = value[j++]; + } + } else if (!strict) { + output[idx++] = value; + } + } + return output; + } + + // Bind a number of an object's methods to that object. Remaining arguments + // are the method names to be bound. Useful for ensuring that all callbacks + // defined on an object belong to it. + var bindAll = restArguments(function(obj, keys) { + keys = flatten$1(keys, false, false); + var index = keys.length; + if (index < 1) throw new Error('bindAll must be passed function names'); + while (index--) { + var key = keys[index]; + obj[key] = bind(obj[key], obj); + } + return obj; + }); + + // Memoize an expensive function by storing its results. + function memoize(func, hasher) { + var memoize = function(key) { + var cache = memoize.cache; + var address = '' + (hasher ? hasher.apply(this, arguments) : key); + if (!has$1(cache, address)) cache[address] = func.apply(this, arguments); + return cache[address]; + }; + memoize.cache = {}; + return memoize; + } + + // Delays a function for the given number of milliseconds, and then calls + // it with the arguments supplied. + var delay = restArguments(function(func, wait, args) { + return setTimeout(function() { + return func.apply(null, args); + }, wait); + }); + + // Defers a function, scheduling it to run after the current call stack has + // cleared. + var defer = partial(delay, _$1, 1); + + // Returns a function, that, when invoked, will only be triggered at most once + // during a given window of time. Normally, the throttled function will run + // as much as it can, without ever going more than once per `wait` duration; + // but if you'd like to disable the execution on the leading edge, pass + // `{leading: false}`. To disable execution on the trailing edge, ditto. + function throttle(func, wait, options) { + var timeout, context, args, result; + var previous = 0; + if (!options) options = {}; + + var later = function() { + previous = options.leading === false ? 0 : now(); + timeout = null; + result = func.apply(context, args); + if (!timeout) context = args = null; + }; + + var throttled = function() { + var _now = now(); + if (!previous && options.leading === false) previous = _now; + var remaining = wait - (_now - previous); + context = this; + args = arguments; + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + previous = _now; + result = func.apply(context, args); + if (!timeout) context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; + + throttled.cancel = function() { + clearTimeout(timeout); + previous = 0; + timeout = context = args = null; + }; + + return throttled; + } + + // When a sequence of calls of the returned function ends, the argument + // function is triggered. The end of a sequence is defined by the `wait` + // parameter. If `immediate` is passed, the argument function will be + // triggered at the beginning of the sequence instead of at the end. + function debounce(func, wait, immediate) { + var timeout, previous, args, result, context; + + var later = function() { + var passed = now() - previous; + if (wait > passed) { + timeout = setTimeout(later, wait - passed); + } else { + timeout = null; + if (!immediate) result = func.apply(context, args); + // This check is needed because `func` can recursively invoke `debounced`. + if (!timeout) args = context = null; + } + }; + + var debounced = restArguments(function(_args) { + context = this; + args = _args; + previous = now(); + if (!timeout) { + timeout = setTimeout(later, wait); + if (immediate) result = func.apply(context, args); + } + return result; + }); + + debounced.cancel = function() { + clearTimeout(timeout); + timeout = args = context = null; + }; + + return debounced; + } + + // Returns the first function passed as an argument to the second, + // allowing you to adjust arguments, run code before and after, and + // conditionally execute the original function. + function wrap(func, wrapper) { + return partial(wrapper, func); + } + + // Returns a negated version of the passed-in predicate. + function negate(predicate) { + return function() { + return !predicate.apply(this, arguments); + }; + } + + // Returns a function that is the composition of a list of functions, each + // consuming the return value of the function that follows. + function compose() { + var args = arguments; + var start = args.length - 1; + return function() { + var i = start; + var result = args[start].apply(this, arguments); + while (i--) result = args[i].call(this, result); + return result; + }; + } + + // Returns a function that will only be executed on and after the Nth call. + function after(times, func) { + return function() { + if (--times < 1) { + return func.apply(this, arguments); + } + }; + } + + // Returns a function that will only be executed up to (but not including) the + // Nth call. + function before(times, func) { + var memo; + return function() { + if (--times > 0) { + memo = func.apply(this, arguments); + } + if (times <= 1) func = null; + return memo; + }; + } + + // Returns a function that will be executed at most one time, no matter how + // often you call it. Useful for lazy initialization. + var once = partial(before, 2); + + // Returns the first key on an object that passes a truth test. + function findKey(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = keys(obj), key; + for (var i = 0, length = _keys.length; i < length; i++) { + key = _keys[i]; + if (predicate(obj[key], key, obj)) return key; + } + } + + // Internal function to generate `_.findIndex` and `_.findLastIndex`. + function createPredicateIndexFinder(dir) { + return function(array, predicate, context) { + predicate = cb(predicate, context); + var length = getLength(array); + var index = dir > 0 ? 0 : length - 1; + for (; index >= 0 && index < length; index += dir) { + if (predicate(array[index], index, array)) return index; + } + return -1; + }; + } + + // Returns the first index on an array-like that passes a truth test. + var findIndex = createPredicateIndexFinder(1); + + // Returns the last index on an array-like that passes a truth test. + var findLastIndex = createPredicateIndexFinder(-1); + + // Use a comparator function to figure out the smallest index at which + // an object should be inserted so as to maintain order. Uses binary search. + function sortedIndex(array, obj, iteratee, context) { + iteratee = cb(iteratee, context, 1); + var value = iteratee(obj); + var low = 0, high = getLength(array); + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; + } + return low; + } + + // Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions. + function createIndexFinder(dir, predicateFind, sortedIndex) { + return function(array, item, idx) { + var i = 0, length = getLength(array); + if (typeof idx == 'number') { + if (dir > 0) { + i = idx >= 0 ? idx : Math.max(idx + length, i); + } else { + length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; + } + } else if (sortedIndex && idx && length) { + idx = sortedIndex(array, item); + return array[idx] === item ? idx : -1; + } + if (item !== item) { + idx = predicateFind(slice.call(array, i, length), isNaN$1); + return idx >= 0 ? idx + i : -1; + } + for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { + if (array[idx] === item) return idx; + } + return -1; + }; + } + + // Return the position of the first occurrence of an item in an array, + // or -1 if the item is not included in the array. + // If the array is large and already in sort order, pass `true` + // for **isSorted** to use binary search. + var indexOf = createIndexFinder(1, findIndex, sortedIndex); + + // Return the position of the last occurrence of an item in an array, + // or -1 if the item is not included in the array. + var lastIndexOf = createIndexFinder(-1, findLastIndex); + + // Return the first value which passes a truth test. + function find(obj, predicate, context) { + var keyFinder = isArrayLike(obj) ? findIndex : findKey; + var key = keyFinder(obj, predicate, context); + if (key !== void 0 && key !== -1) return obj[key]; + } + + // Convenience version of a common use case of `_.find`: getting the first + // object containing specific `key:value` pairs. + function findWhere(obj, attrs) { + return find(obj, matcher(attrs)); + } + + // The cornerstone for collection functions, an `each` + // implementation, aka `forEach`. + // Handles raw objects in addition to array-likes. Treats all + // sparse array-likes as if they were dense. + function each(obj, iteratee, context) { + iteratee = optimizeCb(iteratee, context); + var i, length; + if (isArrayLike(obj)) { + for (i = 0, length = obj.length; i < length; i++) { + iteratee(obj[i], i, obj); + } + } else { + var _keys = keys(obj); + for (i = 0, length = _keys.length; i < length; i++) { + iteratee(obj[_keys[i]], _keys[i], obj); + } + } + return obj; + } + + // Return the results of applying the iteratee to each element. + function map(obj, iteratee, context) { + iteratee = cb(iteratee, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length, + results = Array(length); + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + results[index] = iteratee(obj[currentKey], currentKey, obj); + } + return results; + } + + // Internal helper to create a reducing function, iterating left or right. + function createReduce(dir) { + // Wrap code that reassigns argument variables in a separate function than + // the one that accesses `arguments.length` to avoid a perf hit. (#1991) + var reducer = function(obj, iteratee, memo, initial) { + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length, + index = dir > 0 ? 0 : length - 1; + if (!initial) { + memo = obj[_keys ? _keys[index] : index]; + index += dir; + } + for (; index >= 0 && index < length; index += dir) { + var currentKey = _keys ? _keys[index] : index; + memo = iteratee(memo, obj[currentKey], currentKey, obj); + } + return memo; + }; + + return function(obj, iteratee, memo, context) { + var initial = arguments.length >= 3; + return reducer(obj, optimizeCb(iteratee, context, 4), memo, initial); + }; + } + + // **Reduce** builds up a single result from a list of values, aka `inject`, + // or `foldl`. + var reduce = createReduce(1); + + // The right-associative version of reduce, also known as `foldr`. + var reduceRight = createReduce(-1); + + // Return all the elements that pass a truth test. + function filter(obj, predicate, context) { + var results = []; + predicate = cb(predicate, context); + each(obj, function(value, index, list) { + if (predicate(value, index, list)) results.push(value); + }); + return results; + } + + // Return all the elements for which a truth test fails. + function reject(obj, predicate, context) { + return filter(obj, negate(cb(predicate)), context); + } + + // Determine whether all of the elements pass a truth test. + function every(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (!predicate(obj[currentKey], currentKey, obj)) return false; + } + return true; + } + + // Determine if at least one element in the object passes a truth test. + function some(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike(obj) && keys(obj), + length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (predicate(obj[currentKey], currentKey, obj)) return true; + } + return false; + } + + // Determine if the array or object contains a given item (using `===`). + function contains(obj, item, fromIndex, guard) { + if (!isArrayLike(obj)) obj = values(obj); + if (typeof fromIndex != 'number' || guard) fromIndex = 0; + return indexOf(obj, item, fromIndex) >= 0; + } + + // Invoke a method (with arguments) on every item in a collection. + var invoke = restArguments(function(obj, path, args) { + var contextPath, func; + if (isFunction$1(path)) { + func = path; + } else { + path = toPath(path); + contextPath = path.slice(0, -1); + path = path[path.length - 1]; + } + return map(obj, function(context) { + var method = func; + if (!method) { + if (contextPath && contextPath.length) { + context = deepGet(context, contextPath); + } + if (context == null) return void 0; + method = context[path]; + } + return method == null ? method : method.apply(context, args); + }); + }); + + // Convenience version of a common use case of `_.map`: fetching a property. + function pluck(obj, key) { + return map(obj, property(key)); + } + + // Convenience version of a common use case of `_.filter`: selecting only + // objects containing specific `key:value` pairs. + function where(obj, attrs) { + return filter(obj, matcher(attrs)); + } + + // Return the maximum element (or element-based computation). + function max(obj, iteratee, context) { + var result = -Infinity, lastComputed = -Infinity, + value, computed; + if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { + obj = isArrayLike(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value > result) { + result = value; + } + } + } else { + iteratee = cb(iteratee, context); + each(obj, function(v, index, list) { + computed = iteratee(v, index, list); + if (computed > lastComputed || computed === -Infinity && result === -Infinity) { + result = v; + lastComputed = computed; + } + }); + } + return result; + } + + // Return the minimum element (or element-based computation). + function min(obj, iteratee, context) { + var result = Infinity, lastComputed = Infinity, + value, computed; + if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) { + obj = isArrayLike(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value < result) { + result = value; + } + } + } else { + iteratee = cb(iteratee, context); + each(obj, function(v, index, list) { + computed = iteratee(v, index, list); + if (computed < lastComputed || computed === Infinity && result === Infinity) { + result = v; + lastComputed = computed; + } + }); + } + return result; + } + + // Sample **n** random values from a collection using the modern version of the + // [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle). + // If **n** is not specified, returns a single random element. + // The internal `guard` argument allows it to work with `_.map`. + function sample(obj, n, guard) { + if (n == null || guard) { + if (!isArrayLike(obj)) obj = values(obj); + return obj[random(obj.length - 1)]; + } + var sample = isArrayLike(obj) ? clone(obj) : values(obj); + var length = getLength(sample); + n = Math.max(Math.min(n, length), 0); + var last = length - 1; + for (var index = 0; index < n; index++) { + var rand = random(index, last); + var temp = sample[index]; + sample[index] = sample[rand]; + sample[rand] = temp; + } + return sample.slice(0, n); + } + + // Shuffle a collection. + function shuffle(obj) { + return sample(obj, Infinity); + } + + // Sort the object's values by a criterion produced by an iteratee. + function sortBy(obj, iteratee, context) { + var index = 0; + iteratee = cb(iteratee, context); + return pluck(map(obj, function(value, key, list) { + return { + value: value, + index: index++, + criteria: iteratee(value, key, list) + }; + }).sort(function(left, right) { + var a = left.criteria; + var b = right.criteria; + if (a !== b) { + if (a > b || a === void 0) return 1; + if (a < b || b === void 0) return -1; + } + return left.index - right.index; + }), 'value'); + } + + // An internal function used for aggregate "group by" operations. + function group(behavior, partition) { + return function(obj, iteratee, context) { + var result = partition ? [[], []] : {}; + iteratee = cb(iteratee, context); + each(obj, function(value, index) { + var key = iteratee(value, index, obj); + behavior(result, value, key); + }); + return result; + }; + } + + // Groups the object's values by a criterion. Pass either a string attribute + // to group by, or a function that returns the criterion. + var groupBy = group(function(result, value, key) { + if (has$1(result, key)) result[key].push(value); else result[key] = [value]; + }); + + // Indexes the object's values by a criterion, similar to `_.groupBy`, but for + // when you know that your index values will be unique. + var indexBy = group(function(result, value, key) { + result[key] = value; + }); + + // Counts instances of an object that group by a certain criterion. Pass + // either a string attribute to count by, or a function that returns the + // criterion. + var countBy = group(function(result, value, key) { + if (has$1(result, key)) result[key]++; else result[key] = 1; + }); + + // Split a collection into two arrays: one whose elements all pass the given + // truth test, and one whose elements all do not pass the truth test. + var partition = group(function(result, value, pass) { + result[pass ? 0 : 1].push(value); + }, true); + + // Safely create a real, live array from anything iterable. + var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; + function toArray(obj) { + if (!obj) return []; + if (isArray(obj)) return slice.call(obj); + if (isString(obj)) { + // Keep surrogate pair characters together. + return obj.match(reStrSymbol); + } + if (isArrayLike(obj)) return map(obj, identity); + return values(obj); + } + + // Return the number of elements in a collection. + function size(obj) { + if (obj == null) return 0; + return isArrayLike(obj) ? obj.length : keys(obj).length; + } + + // Internal `_.pick` helper function to determine whether `key` is an enumerable + // property name of `obj`. + function keyInObj(value, key, obj) { + return key in obj; + } + + // Return a copy of the object only containing the allowed properties. + var pick = restArguments(function(obj, keys) { + var result = {}, iteratee = keys[0]; + if (obj == null) return result; + if (isFunction$1(iteratee)) { + if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]); + keys = allKeys(obj); + } else { + iteratee = keyInObj; + keys = flatten$1(keys, false, false); + obj = Object(obj); + } + for (var i = 0, length = keys.length; i < length; i++) { + var key = keys[i]; + var value = obj[key]; + if (iteratee(value, key, obj)) result[key] = value; + } + return result; + }); + + // Return a copy of the object without the disallowed properties. + var omit = restArguments(function(obj, keys) { + var iteratee = keys[0], context; + if (isFunction$1(iteratee)) { + iteratee = negate(iteratee); + if (keys.length > 1) context = keys[1]; + } else { + keys = map(flatten$1(keys, false, false), String); + iteratee = function(value, key) { + return !contains(keys, key); + }; + } + return pick(obj, iteratee, context); + }); + + // Returns everything but the last entry of the array. Especially useful on + // the arguments object. Passing **n** will return all the values in + // the array, excluding the last N. + function initial(array, n, guard) { + return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); + } + + // Get the first element of an array. Passing **n** will return the first N + // values in the array. The **guard** check allows it to work with `_.map`. + function first(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[0]; + return initial(array, array.length - n); + } + + // Returns everything but the first entry of the `array`. Especially useful on + // the `arguments` object. Passing an **n** will return the rest N values in the + // `array`. + function rest(array, n, guard) { + return slice.call(array, n == null || guard ? 1 : n); + } + + // Get the last element of an array. Passing **n** will return the last N + // values in the array. + function last(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[array.length - 1]; + return rest(array, Math.max(0, array.length - n)); + } + + // Trim out all falsy values from an array. + function compact(array) { + return filter(array, Boolean); + } + + // Flatten out an array, either recursively (by default), or up to `depth`. + // Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively. + function flatten(array, depth) { + return flatten$1(array, depth, false); + } + + // Take the difference between one array and a number of other arrays. + // Only the elements present in just the first array will remain. + var difference = restArguments(function(array, rest) { + rest = flatten$1(rest, true, true); + return filter(array, function(value){ + return !contains(rest, value); + }); + }); + + // Return a version of the array that does not contain the specified value(s). + var without = restArguments(function(array, otherArrays) { + return difference(array, otherArrays); + }); + + // Produce a duplicate-free version of the array. If the array has already + // been sorted, you have the option of using a faster algorithm. + // The faster algorithm will not work with an iteratee if the iteratee + // is not a one-to-one function, so providing an iteratee will disable + // the faster algorithm. + function uniq(array, isSorted, iteratee, context) { + if (!isBoolean(isSorted)) { + context = iteratee; + iteratee = isSorted; + isSorted = false; + } + if (iteratee != null) iteratee = cb(iteratee, context); + var result = []; + var seen = []; + for (var i = 0, length = getLength(array); i < length; i++) { + var value = array[i], + computed = iteratee ? iteratee(value, i, array) : value; + if (isSorted && !iteratee) { + if (!i || seen !== computed) result.push(value); + seen = computed; + } else if (iteratee) { + if (!contains(seen, computed)) { + seen.push(computed); + result.push(value); + } + } else if (!contains(result, value)) { + result.push(value); + } + } + return result; + } + + // Produce an array that contains the union: each distinct element from all of + // the passed-in arrays. + var union = restArguments(function(arrays) { + return uniq(flatten$1(arrays, true, true)); + }); + + // Produce an array that contains every item shared between all the + // passed-in arrays. + function intersection(array) { + var result = []; + var argsLength = arguments.length; + for (var i = 0, length = getLength(array); i < length; i++) { + var item = array[i]; + if (contains(result, item)) continue; + var j; + for (j = 1; j < argsLength; j++) { + if (!contains(arguments[j], item)) break; + } + if (j === argsLength) result.push(item); + } + return result; + } + + // Complement of zip. Unzip accepts an array of arrays and groups + // each array's elements on shared indices. + function unzip(array) { + var length = array && max(array, getLength).length || 0; + var result = Array(length); + + for (var index = 0; index < length; index++) { + result[index] = pluck(array, index); + } + return result; + } + + // Zip together multiple lists into a single array -- elements that share + // an index go together. + var zip = restArguments(unzip); + + // Converts lists into objects. Pass either a single array of `[key, value]` + // pairs, or two parallel arrays of the same length -- one of keys, and one of + // the corresponding values. Passing by pairs is the reverse of `_.pairs`. + function object(list, values) { + var result = {}; + for (var i = 0, length = getLength(list); i < length; i++) { + if (values) { + result[list[i]] = values[i]; + } else { + result[list[i][0]] = list[i][1]; + } + } + return result; + } + + // Generate an integer Array containing an arithmetic progression. A port of + // the native Python `range()` function. See + // [the Python documentation](https://docs.python.org/library/functions.html#range). + function range(start, stop, step) { + if (stop == null) { + stop = start || 0; + start = 0; + } + if (!step) { + step = stop < start ? -1 : 1; + } + + var length = Math.max(Math.ceil((stop - start) / step), 0); + var range = Array(length); + + for (var idx = 0; idx < length; idx++, start += step) { + range[idx] = start; + } + + return range; + } + + // Chunk a single array into multiple arrays, each containing `count` or fewer + // items. + function chunk(array, count) { + if (count == null || count < 1) return []; + var result = []; + var i = 0, length = array.length; + while (i < length) { + result.push(slice.call(array, i, i += count)); + } + return result; + } + + // Helper function to continue chaining intermediate results. + function chainResult(instance, obj) { + return instance._chain ? _$1(obj).chain() : obj; + } + + // Add your own custom functions to the Underscore object. + function mixin(obj) { + each(functions(obj), function(name) { + var func = _$1[name] = obj[name]; + _$1.prototype[name] = function() { + var args = [this._wrapped]; + push.apply(args, arguments); + return chainResult(this, func.apply(_$1, args)); + }; + }); + return _$1; + } + + // Add all mutator `Array` functions to the wrapper. + each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { + var method = ArrayProto[name]; + _$1.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) { + method.apply(obj, arguments); + if ((name === 'shift' || name === 'splice') && obj.length === 0) { + delete obj[0]; + } + } + return chainResult(this, obj); + }; + }); + + // Add all accessor `Array` functions to the wrapper. + each(['concat', 'join', 'slice'], function(name) { + var method = ArrayProto[name]; + _$1.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) obj = method.apply(obj, arguments); + return chainResult(this, obj); + }; + }); + + // Named Exports + + var allExports = { + __proto__: null, + VERSION: VERSION, + restArguments: restArguments, + isObject: isObject, + isNull: isNull, + isUndefined: isUndefined, + isBoolean: isBoolean, + isElement: isElement, + isString: isString, + isNumber: isNumber, + isDate: isDate, + isRegExp: isRegExp, + isError: isError, + isSymbol: isSymbol, + isArrayBuffer: isArrayBuffer, + isDataView: isDataView$1, + isArray: isArray, + isFunction: isFunction$1, + isArguments: isArguments$1, + isFinite: isFinite$1, + isNaN: isNaN$1, + isTypedArray: isTypedArray$1, + isEmpty: isEmpty, + isMatch: isMatch, + isEqual: isEqual, + isMap: isMap, + isWeakMap: isWeakMap, + isSet: isSet, + isWeakSet: isWeakSet, + keys: keys, + allKeys: allKeys, + values: values, + pairs: pairs, + invert: invert, + functions: functions, + methods: functions, + extend: extend, + extendOwn: extendOwn, + assign: extendOwn, + defaults: defaults, + create: create, + clone: clone, + tap: tap, + get: get, + has: has, + mapObject: mapObject, + identity: identity, + constant: constant, + noop: noop, + toPath: toPath$1, + property: property, + propertyOf: propertyOf, + matcher: matcher, + matches: matcher, + times: times, + random: random, + now: now, + escape: _escape, + unescape: _unescape, + templateSettings: templateSettings, + template: template, + result: result, + uniqueId: uniqueId, + chain: chain, + iteratee: iteratee, + partial: partial, + bind: bind, + bindAll: bindAll, + memoize: memoize, + delay: delay, + defer: defer, + throttle: throttle, + debounce: debounce, + wrap: wrap, + negate: negate, + compose: compose, + after: after, + before: before, + once: once, + findKey: findKey, + findIndex: findIndex, + findLastIndex: findLastIndex, + sortedIndex: sortedIndex, + indexOf: indexOf, + lastIndexOf: lastIndexOf, + find: find, + detect: find, + findWhere: findWhere, + each: each, + forEach: each, + map: map, + collect: map, + reduce: reduce, + foldl: reduce, + inject: reduce, + reduceRight: reduceRight, + foldr: reduceRight, + filter: filter, + select: filter, + reject: reject, + every: every, + all: every, + some: some, + any: some, + contains: contains, + includes: contains, + include: contains, + invoke: invoke, + pluck: pluck, + where: where, + max: max, + min: min, + shuffle: shuffle, + sample: sample, + sortBy: sortBy, + groupBy: groupBy, + indexBy: indexBy, + countBy: countBy, + partition: partition, + toArray: toArray, + size: size, + pick: pick, + omit: omit, + first: first, + head: first, + take: first, + initial: initial, + last: last, + rest: rest, + tail: rest, + drop: rest, + compact: compact, + flatten: flatten, + without: without, + uniq: uniq, + unique: uniq, + union: union, + intersection: intersection, + difference: difference, + unzip: unzip, + transpose: unzip, + zip: zip, + object: object, + range: range, + chunk: chunk, + mixin: mixin, + 'default': _$1 + }; + + // Default Export + + // Add all of the Underscore functions to the wrapper object. + var _ = mixin(allExports); + // Legacy Node.js API. + _._ = _; + + return _; + +}))); +//# sourceMappingURL=underscore-umd.js.map diff --git a/docs/build/html/_static/underscore-1.3.1.js b/docs/build/html/_static/underscore-1.3.1.js deleted file mode 100644 index 208d4cd..0000000 --- a/docs/build/html/_static/underscore-1.3.1.js +++ /dev/null @@ -1,999 +0,0 @@ -// Underscore.js 1.3.1 -// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `global` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Establish the object that gets returned to break out of a loop iteration. - var breaker = {}; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var slice = ArrayProto.slice, - unshift = ArrayProto.unshift, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeForEach = ArrayProto.forEach, - nativeMap = ArrayProto.map, - nativeReduce = ArrayProto.reduce, - nativeReduceRight = ArrayProto.reduceRight, - nativeFilter = ArrayProto.filter, - nativeEvery = ArrayProto.every, - nativeSome = ArrayProto.some, - nativeIndexOf = ArrayProto.indexOf, - nativeLastIndexOf = ArrayProto.lastIndexOf, - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { return new wrapper(obj); }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object via a string identifier, - // for Closure Compiler "advanced" mode. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root['_'] = _; - } - - // Current version. - _.VERSION = '1.3.1'; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles objects with the built-in `forEach`, arrays, and raw objects. - // Delegates to **ECMAScript 5**'s native `forEach` if available. - var each = _.each = _.forEach = function(obj, iterator, context) { - if (obj == null) return; - if (nativeForEach && obj.forEach === nativeForEach) { - obj.forEach(iterator, context); - } else if (obj.length === +obj.length) { - for (var i = 0, l = obj.length; i < l; i++) { - if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; - } - } else { - for (var key in obj) { - if (_.has(obj, key)) { - if (iterator.call(context, obj[key], key, obj) === breaker) return; - } - } - } - }; - - // Return the results of applying the iterator to each element. - // Delegates to **ECMAScript 5**'s native `map` if available. - _.map = _.collect = function(obj, iterator, context) { - var results = []; - if (obj == null) return results; - if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); - each(obj, function(value, index, list) { - results[results.length] = iterator.call(context, value, index, list); - }); - if (obj.length === +obj.length) results.length = obj.length; - return results; - }; - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. - _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduce && obj.reduce === nativeReduce) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); - } - each(obj, function(value, index, list) { - if (!initial) { - memo = value; - initial = true; - } else { - memo = iterator.call(context, memo, value, index, list); - } - }); - if (!initial) throw new TypeError('Reduce of empty array with no initial value'); - return memo; - }; - - // The right-associative version of reduce, also known as `foldr`. - // Delegates to **ECMAScript 5**'s native `reduceRight` if available. - _.reduceRight = _.foldr = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); - } - var reversed = _.toArray(obj).reverse(); - if (context && !initial) iterator = _.bind(iterator, context); - return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); - }; - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, iterator, context) { - var result; - any(obj, function(value, index, list) { - if (iterator.call(context, value, index, list)) { - result = value; - return true; - } - }); - return result; - }; - - // Return all the elements that pass a truth test. - // Delegates to **ECMAScript 5**'s native `filter` if available. - // Aliased as `select`. - _.filter = _.select = function(obj, iterator, context) { - var results = []; - if (obj == null) return results; - if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); - each(obj, function(value, index, list) { - if (iterator.call(context, value, index, list)) results[results.length] = value; - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, iterator, context) { - var results = []; - if (obj == null) return results; - each(obj, function(value, index, list) { - if (!iterator.call(context, value, index, list)) results[results.length] = value; - }); - return results; - }; - - // Determine whether all of the elements match a truth test. - // Delegates to **ECMAScript 5**'s native `every` if available. - // Aliased as `all`. - _.every = _.all = function(obj, iterator, context) { - var result = true; - if (obj == null) return result; - if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); - each(obj, function(value, index, list) { - if (!(result = result && iterator.call(context, value, index, list))) return breaker; - }); - return result; - }; - - // Determine if at least one element in the object matches a truth test. - // Delegates to **ECMAScript 5**'s native `some` if available. - // Aliased as `any`. - var any = _.some = _.any = function(obj, iterator, context) { - iterator || (iterator = _.identity); - var result = false; - if (obj == null) return result; - if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); - each(obj, function(value, index, list) { - if (result || (result = iterator.call(context, value, index, list))) return breaker; - }); - return !!result; - }; - - // Determine if a given value is included in the array or object using `===`. - // Aliased as `contains`. - _.include = _.contains = function(obj, target) { - var found = false; - if (obj == null) return found; - if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; - found = any(obj, function(value) { - return value === target; - }); - return found; - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - return _.map(obj, function(value) { - return (_.isFunction(method) ? method || value : value[method]).apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, function(value){ return value[key]; }); - }; - - // Return the maximum element or (element-based computation). - _.max = function(obj, iterator, context) { - if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj); - if (!iterator && _.isEmpty(obj)) return -Infinity; - var result = {computed : -Infinity}; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - computed >= result.computed && (result = {value : value, computed : computed}); - }); - return result.value; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iterator, context) { - if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj); - if (!iterator && _.isEmpty(obj)) return Infinity; - var result = {computed : Infinity}; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - computed < result.computed && (result = {value : value, computed : computed}); - }); - return result.value; - }; - - // Shuffle an array. - _.shuffle = function(obj) { - var shuffled = [], rand; - each(obj, function(value, index, list) { - if (index == 0) { - shuffled[0] = value; - } else { - rand = Math.floor(Math.random() * (index + 1)); - shuffled[index] = shuffled[rand]; - shuffled[rand] = value; - } - }); - return shuffled; - }; - - // Sort the object's values by a criterion produced by an iterator. - _.sortBy = function(obj, iterator, context) { - return _.pluck(_.map(obj, function(value, index, list) { - return { - value : value, - criteria : iterator.call(context, value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }), 'value'); - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = function(obj, val) { - var result = {}; - var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; - each(obj, function(value, index) { - var key = iterator(value, index); - (result[key] || (result[key] = [])).push(value); - }); - return result; - }; - - // Use a comparator function to figure out at what index an object should - // be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iterator) { - iterator || (iterator = _.identity); - var low = 0, high = array.length; - while (low < high) { - var mid = (low + high) >> 1; - iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; - } - return low; - }; - - // Safely convert anything iterable into a real, live array. - _.toArray = function(iterable) { - if (!iterable) return []; - if (iterable.toArray) return iterable.toArray(); - if (_.isArray(iterable)) return slice.call(iterable); - if (_.isArguments(iterable)) return slice.call(iterable); - return _.values(iterable); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - return _.toArray(obj).length; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head`. The **guard** check allows it to work - // with `_.map`. - _.first = _.head = function(array, n, guard) { - return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; - }; - - // Returns everything but the last entry of the array. Especcialy useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. The **guard** check allows it to work with - // `_.map`. - _.initial = function(array, n, guard) { - return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. The **guard** check allows it to work with `_.map`. - _.last = function(array, n, guard) { - if ((n != null) && !guard) { - return slice.call(array, Math.max(array.length - n, 0)); - } else { - return array[array.length - 1]; - } - }; - - // Returns everything but the first entry of the array. Aliased as `tail`. - // Especially useful on the arguments object. Passing an **index** will return - // the rest of the values in the array from that index onward. The **guard** - // check allows it to work with `_.map`. - _.rest = _.tail = function(array, index, guard) { - return slice.call(array, (index == null) || guard ? 1 : index); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, function(value){ return !!value; }); - }; - - // Return a completely flattened version of an array. - _.flatten = function(array, shallow) { - return _.reduce(array, function(memo, value) { - if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value)); - memo[memo.length] = value; - return memo; - }, []); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iterator) { - var initial = iterator ? _.map(array, iterator) : array; - var result = []; - _.reduce(initial, function(memo, el, i) { - if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) { - memo[memo.length] = el; - result[result.length] = array[i]; - } - return memo; - }, []); - return result; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(_.flatten(arguments, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. (Aliased as "intersect" for back-compat.) - _.intersection = _.intersect = function(array) { - var rest = slice.call(arguments, 1); - return _.filter(_.uniq(array), function(item) { - return _.every(rest, function(other) { - return _.indexOf(other, item) >= 0; - }); - }); - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = _.flatten(slice.call(arguments, 1)); - return _.filter(array, function(value){ return !_.include(rest, value); }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - var args = slice.call(arguments); - var length = _.max(_.pluck(args, 'length')); - var results = new Array(length); - for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); - return results; - }; - - // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), - // we need this function. Return the position of the first occurrence of an - // item in an array, or -1 if the item is not included in the array. - // Delegates to **ECMAScript 5**'s native `indexOf` if available. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - if (array == null) return -1; - var i, l; - if (isSorted) { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); - for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i; - return -1; - }; - - // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. - _.lastIndexOf = function(array, item) { - if (array == null) return -1; - if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); - var i = array.length; - while (i--) if (i in array && array[i] === item) return i; - return -1; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = arguments[2] || 1; - - var len = Math.max(Math.ceil((stop - start) / step), 0); - var idx = 0; - var range = new Array(len); - - while(idx < len) { - range[idx++] = start; - start += step; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Reusable constructor function for prototype setting. - var ctor = function(){}; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Binding with arguments is also known as `curry`. - // Delegates to **ECMAScript 5**'s native `Function.bind` if available. - // We check for `func.bind` first, to fail fast when `func` is undefined. - _.bind = function bind(func, context) { - var bound, args; - if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError; - args = slice.call(arguments, 2); - return bound = function() { - if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); - ctor.prototype = func.prototype; - var self = new ctor; - var result = func.apply(self, args.concat(slice.call(arguments))); - if (Object(result) === result) return result; - return self; - }; - }; - - // Bind all of an object's methods to that object. Useful for ensuring that - // all callbacks defined on an object belong to it. - _.bindAll = function(obj) { - var funcs = slice.call(arguments, 1); - if (funcs.length == 0) funcs = _.functions(obj); - each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memo = {}; - hasher || (hasher = _.identity); - return function() { - var key = hasher.apply(this, arguments); - return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); - }; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ return func.apply(func, args); }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = function(func) { - return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); - }; - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. - _.throttle = function(func, wait) { - var context, args, timeout, throttling, more; - var whenDone = _.debounce(function(){ more = throttling = false; }, wait); - return function() { - context = this; args = arguments; - var later = function() { - timeout = null; - if (more) func.apply(context, args); - whenDone(); - }; - if (!timeout) timeout = setTimeout(later, wait); - if (throttling) { - more = true; - } else { - func.apply(context, args); - } - whenDone(); - throttling = true; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. - _.debounce = function(func, wait) { - var timeout; - return function() { - var context = this, args = arguments; - var later = function() { - timeout = null; - func.apply(context, args); - }; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = function(func) { - var ran = false, memo; - return function() { - if (ran) return memo; - ran = true; - return memo = func.apply(this, arguments); - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return function() { - var args = [func].concat(slice.call(arguments, 0)); - return wrapper.apply(this, args); - }; - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var funcs = arguments; - return function() { - var args = arguments; - for (var i = funcs.length - 1; i >= 0; i--) { - args = [funcs[i].apply(this, args)]; - } - return args[0]; - }; - }; - - // Returns a function that will only be executed after being called N times. - _.after = function(times, func) { - if (times <= 0) return func(); - return function() { - if (--times < 1) { return func.apply(this, arguments); } - }; - }; - - // Object Functions - // ---------------- - - // Retrieve the names of an object's properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = nativeKeys || function(obj) { - if (obj !== Object(obj)) throw new TypeError('Invalid object'); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - return _.map(obj, _.identity); - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = function(obj) { - each(slice.call(arguments, 1), function(source) { - for (var prop in source) { - obj[prop] = source[prop]; - } - }); - return obj; - }; - - // Fill in a given object with default properties. - _.defaults = function(obj) { - each(slice.call(arguments, 1), function(source) { - for (var prop in source) { - if (obj[prop] == null) obj[prop] = source[prop]; - } - }); - return obj; - }; - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Internal recursive comparison function. - function eq(a, b, stack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. - if (a === b) return a !== 0 || 1 / a == 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a._chain) a = a._wrapped; - if (b._chain) b = b._wrapped; - // Invoke a custom `isEqual` method if one is provided. - if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); - if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className != toString.call(b)) return false; - switch (className) { - // Strings, numbers, dates, and booleans are compared by value. - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return a == String(b); - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for - // other numeric values. - return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a == +b; - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source == b.source && - a.global == b.global && - a.multiline == b.multiline && - a.ignoreCase == b.ignoreCase; - } - if (typeof a != 'object' || typeof b != 'object') return false; - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - var length = stack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (stack[length] == a) return true; - } - // Add the first object to the stack of traversed objects. - stack.push(a); - var size = 0, result = true; - // Recursively compare objects and arrays. - if (className == '[object Array]') { - // Compare array lengths to determine if a deep comparison is necessary. - size = a.length; - result = size == b.length; - if (result) { - // Deep compare the contents, ignoring non-numeric properties. - while (size--) { - // Ensure commutative equality for sparse arrays. - if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; - } - } - } else { - // Objects with different constructors are not equivalent. - if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; - // Deep compare objects. - for (var key in a) { - if (_.has(a, key)) { - // Count the expected number of properties. - size++; - // Deep compare each member. - if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break; - } - } - // Ensure that both objects contain the same number of properties. - if (result) { - for (key in b) { - if (_.has(b, key) && !(size--)) break; - } - result = !size; - } - } - // Remove the first object from the stack of traversed objects. - stack.pop(); - return result; - } - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b, []); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; - for (var key in obj) if (_.has(obj, key)) return false; - return true; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType == 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) == '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - return obj === Object(obj); - }; - - // Is a given variable an arguments object? - _.isArguments = function(obj) { - return toString.call(obj) == '[object Arguments]'; - }; - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return !!(obj && _.has(obj, 'callee')); - }; - } - - // Is a given value a function? - _.isFunction = function(obj) { - return toString.call(obj) == '[object Function]'; - }; - - // Is a given value a string? - _.isString = function(obj) { - return toString.call(obj) == '[object String]'; - }; - - // Is a given value a number? - _.isNumber = function(obj) { - return toString.call(obj) == '[object Number]'; - }; - - // Is the given value `NaN`? - _.isNaN = function(obj) { - // `NaN` is the only value for which `===` is not reflexive. - return obj !== obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; - }; - - // Is a given value a date? - _.isDate = function(obj) { - return toString.call(obj) == '[object Date]'; - }; - - // Is the given value a regular expression? - _.isRegExp = function(obj) { - return toString.call(obj) == '[object RegExp]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Has own property? - _.has = function(obj, key) { - return hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iterators. - _.identity = function(value) { - return value; - }; - - // Run a function **n** times. - _.times = function (n, iterator, context) { - for (var i = 0; i < n; i++) iterator.call(context, i); - }; - - // Escape a string for HTML interpolation. - _.escape = function(string) { - return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/'); - }; - - // Add your own custom functions to the Underscore object, ensuring that - // they're correctly added to the OOP wrapper as well. - _.mixin = function(obj) { - each(_.functions(obj), function(name){ - addToWrapper(name, _[name] = obj[name]); - }); - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = idCounter++; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /.^/; - - // Within an interpolation, evaluation, or escaping, remove HTML escaping - // that had been previously added. - var unescape = function(code) { - return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'"); - }; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - _.template = function(str, data) { - var c = _.templateSettings; - var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' + - 'with(obj||{}){__p.push(\'' + - str.replace(/\\/g, '\\\\') - .replace(/'/g, "\\'") - .replace(c.escape || noMatch, function(match, code) { - return "',_.escape(" + unescape(code) + "),'"; - }) - .replace(c.interpolate || noMatch, function(match, code) { - return "'," + unescape(code) + ",'"; - }) - .replace(c.evaluate || noMatch, function(match, code) { - return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('"; - }) - .replace(/\r/g, '\\r') - .replace(/\n/g, '\\n') - .replace(/\t/g, '\\t') - + "');}return __p.join('');"; - var func = new Function('obj', '_', tmpl); - if (data) return func(data, _); - return function(data) { - return func.call(this, data, _); - }; - }; - - // Add a "chain" function, which will delegate to the wrapper. - _.chain = function(obj) { - return _(obj).chain(); - }; - - // The OOP Wrapper - // --------------- - - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - var wrapper = function(obj) { this._wrapped = obj; }; - - // Expose `wrapper.prototype` as `_.prototype` - _.prototype = wrapper.prototype; - - // Helper function to continue chaining intermediate results. - var result = function(obj, chain) { - return chain ? _(obj).chain() : obj; - }; - - // A method to easily add functions to the OOP wrapper. - var addToWrapper = function(name, func) { - wrapper.prototype[name] = function() { - var args = slice.call(arguments); - unshift.call(args, this._wrapped); - return result(func.apply(_, args), this._chain); - }; - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - wrapper.prototype[name] = function() { - var wrapped = this._wrapped; - method.apply(wrapped, arguments); - var length = wrapped.length; - if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0]; - return result(wrapped, this._chain); - }; - }); - - // Add all accessor Array functions to the wrapper. - each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - wrapper.prototype[name] = function() { - return result(method.apply(this._wrapped, arguments), this._chain); - }; - }); - - // Start chaining a wrapped Underscore object. - wrapper.prototype.chain = function() { - this._chain = true; - return this; - }; - - // Extracts the result from a wrapped and chained object. - wrapper.prototype.value = function() { - return this._wrapped; - }; - -}).call(this); diff --git a/docs/build/html/_static/underscore.js b/docs/build/html/_static/underscore.js index 5b55f32..cf177d4 100644 --- a/docs/build/html/_static/underscore.js +++ b/docs/build/html/_static/underscore.js @@ -1,31 +1,6 @@ -// Underscore.js 1.3.1 -// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Underscore is freely distributable under the MIT license. -// Portions of Underscore are inspired or borrowed from Prototype, -// Oliver Steele's Functional, and John Resig's Micro-Templating. -// For all details and documentation: -// http://documentcloud.github.com/underscore -(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== -c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, -h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= -b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a== -null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= -function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= -e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= -function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, -c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; -b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, -1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; -b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; -b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), -function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ -u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= -function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= -true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); +!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){ +// Underscore.js 1.13.1 +// https://underscorejs.org +// (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors +// Underscore may be freely distributed under the MIT license. +var n="1.13.1",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,d=isFinite,g=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e":">",'"':""","'":"'","`":"`"},Cn=Ln($n),Kn=Ln(_n($n)),Jn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Gn=/(.)^/,Hn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Qn=/\\|'|\r|\n|\u2028|\u2029/g;function Xn(n){return"\\"+Hn[n]}var Yn=/^\s*(\w|\$)+\s*$/;var Zn=0;function nr(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var rr=j((function(n,r){var t=rr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a1)ur(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var lr=rr(cr,2);function sr(n,r,t){r=qn(r,t);for(var e,u=nn(n),o=0,i=u.length;o0?0:u-1;o>=0&&o0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a=3;return r(n,Fn(t,u,4),e,o)}}var Ar=wr(1),xr=wr(-1);function Sr(n,r,t){var e=[];return r=qn(r,t),jr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Or(n,r,t){r=qn(r,t);for(var e=!er(n)&&nn(n),u=(e||n).length,o=0;o=0}var Br=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Nn(r),e=r.slice(0,-1),r=r[r.length-1]),_r(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=In(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Nr(n,r){return _r(n,Rn(r))}function Ir(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=er(n)?n:jn(n)).length;ao&&(o=e);else r=qn(r,t),jr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}function Tr(n,r,t){if(null==r||t)return er(n)||(n=jn(n)),n[Wn(n.length-1)];var e=er(n)?En(n):jn(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i1&&(e=Fn(e,r[1])),r=an(n)):(e=qr,r=ur(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u1&&(t=r[1])):(r=_r(ur(r,!1,!1),String),e=function(n,t){return!Er(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=ur(r,!0,!0),Sr(n,(function(n){return!Er(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=qn(t,e));for(var u=[],o=[],i=0,a=Y(n);ir?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o,i,a,f=function(){var c=zn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(i=n.apply(a,o)),e||(o=a=null))},c=j((function(c){return a=this,o=c,u=zn(),e||(e=setTimeout(f,r),t&&(i=n.apply(a,o))),i}));return c.cancel=function(){clearTimeout(e),e=o=a=null},c},wrap:function(n,r){return rr(r,n)},negate:fr,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:cr,once:lr,findKey:sr,findIndex:vr,findLastIndex:hr,sortedIndex:yr,indexOf:gr,lastIndexOf:br,find:mr,detect:mr,findWhere:function(n,r){return mr(n,Dn(r))},each:jr,forEach:jr,map:_r,collect:_r,reduce:Ar,foldl:Ar,inject:Ar,reduceRight:xr,foldr:xr,filter:Sr,select:Sr,reject:function(n,r,t){return Sr(n,fr(qn(r)),t)},every:Or,all:Or,some:Mr,any:Mr,contains:Er,includes:Er,include:Er,invoke:Br,pluck:Nr,where:function(n,r){return Sr(n,Dn(r))},max:Ir,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=er(n)?n:jn(n)).length;ae||void 0===t)return 1;if(t - - Command Line Tools & Algorithms — CRIKit2 0.4.1 documentation - - - + + + Command Line Tools & Algorithms — CRIKit2 0.4.3 documentation + + + - - @@ -34,7 +33,7 @@

    Navigation

  • previous |
  • - +
    @@ -54,9 +53,9 @@

    Navigation



    -
    +

    Command Line Tools & Algorithms

    -
    +
    @@ -65,12 +64,16 @@

    Command Line Tools & Algorithms
    -

    Previous topic

    -

    Walk-Thru: CRI Processing

    -

    Next topic

    -

    Input/Output (IO) Interfaces for CRIkit2

    +
    +

    Previous topic

    +

    Walk-Thru: CRI Processing

    +
    +

    This Page

    \ No newline at end of file diff --git a/docs/build/html/api.html b/docs/build/html/api.html index 7424237..278949f 100644 --- a/docs/build/html/api.html +++ b/docs/build/html/api.html @@ -4,16 +4,15 @@ - - API Reference — CRIKit2 0.4.1 documentation - - - + + + API Reference — CRIKit2 0.4.3 documentation + + + - - @@ -30,7 +29,7 @@

    Navigation

  • previous |
  • - +
    @@ -50,14 +49,14 @@

    Navigation



    -
    +

    API Reference

    This is not an exhaustive list of classes and functions, but rather those most likely to be of interest to users and developer. See Index and Module Index for a full list.

    -
    +

    crikit.cri: Coherent Raman Imagery (CRI) classes and functions

    -
    +

    Classes

    @@ -65,19 +64,19 @@

    Classes

    - + - + - +

    cri.kk.KramersKronig([cars_amp_offset, …])

    cri.kk.KramersKronig([cars_amp_offset, ...])

    Retrieve the real and imaginary components of coherent Raman data via the Kramers-Kronig (KK) relation.

    cri.error_correction.PhaseErrCorrectALS([…])

    cri.error_correction.PhaseErrCorrectALS([...])

    Phase error correction (PEC) using asymmetric least squares (ALS).

    cri.error_correction.ScaleErrCorrectSG([…])

    cri.error_correction.ScaleErrCorrectSG([...])

    Scale error correction using Savitky-Golay

    -
    -
    +
    +

    Functions

    @@ -85,19 +84,19 @@

    Functions

    - + - +

    cri.algorithms.kk.kkrelation(bg, cri[, …])

    cri.algorithms.kk.kkrelation(bg, cri[, ...])

    Retrieve the real and imaginary components of a CRI spectra(um) via the Kramers-Kronig (KK) relation.

    cri.algorithms.kk.hilbertfft(y[, …])

    cri.algorithms.kk.hilbertfft(y[, ...])

    Compute the one-dimensional Hilbert Transform.

    -
    -
    -
    + + +

    crikit.data: Data container classes

    -
    +

    Classes

    @@ -105,28 +104,22 @@

    Classes

    - + - + - - - - + - - -

    data.frequency.Frequency([data, calib, …])

    data.frequency.Frequency([data, calib, ...])

    Frequency [,wavelength, and wavenumber] class

    data.replicate.Replicate([data, calib, …])

    data.replicate.Replicate([data, calib, ...])

    Replicate class

    data.spectrum.Spectrum([data, freq, label, …])

    Spectrum class

    data.spectra.Spectra([data, freq, label, …])

    data.spectra.Spectra([data, freq, label, ...])

    Spectra class

    data.hsi.Hsi([data, freq, x, y, x_rep, …])

    Hyperspectral imagery class

    -
    -
    -
    + + +

    crikit.io: Input/Output (IO) functions

    -
    +

    Functions

    @@ -134,31 +127,31 @@

    Functions

    - + - + - + - + - +

    io.csv_nist.csv_nist_import_data(pth, …[, …])

    io.csv_nist.csv_nist_import_data(pth, ...[, ...])

    Import dataset(s) from HDF file

    io.hdf5.hdf_import_data(pth, filename, dset_list)

    Import dataset(s) from HDF file

    io.meta_configs.special_nist_bcars1_sample_scan()

    Return import attributes particular to the “BCARS 1” system at NIST

    Return import attributes particular to the "BCARS 1" system at NIST

    io.meta_configs.special_nist_bcars2()

    Return import attributes particular to the “BCARS 2” system at NIST

    Return import attributes particular to the "BCARS 2" system at NIST

    io.meta_process.meta_process(rosetta, …)

    io.meta_process.meta_process(rosetta, ...)

    Uses a conversion dict (rosetta) to process the meta data in output_cls_instance

    io.meta_process.rosetta_query(key, rosetta, …)

    io.meta_process.rosetta_query(key, rosetta, ...)

    Return the highest-priority value

    -
    -
    -
    + + +

    crikit.measurement: Measurement classes

    -
    +

    Classes

    @@ -175,7 +168,7 @@

    Classes

    - + @@ -192,11 +185,11 @@

    Classes

    measurement.peakamps.MeasurePeakAdd(f1, f2)

    Meausure the addition of two peaks (f1 + f2).

    measurement.peakamps.MeasurePeakBWTroughs(pk, …)

    measurement.peakamps.MeasurePeakBWTroughs(pk, ...)

    Meausure the amplitude of a peak between troughs.

    measurement.peakamps.MeasurePeakMinus(f1, f2)

    -
    -
    -
    + + +

    crikit.preprocess: Preprocessing classes and functions

    -
    +

    Classes

    @@ -204,29 +197,29 @@

    Classes

    - + - + - + - + - + - - + + - - + + @@ -234,13 +227,13 @@

    Classes

    - + - + @@ -251,11 +244,11 @@

    Classes

    preprocess.algorithms.als.AlsCvxopt([…])

    preprocess.algorithms.als.AlsCvxopt([...])

    preprocess.algorithms.anscombe.anscombe_inverse_exact_unbiased(fsignal)

    Applies an exact, unbiased inverse of the Anscombe variance-stabilizing transformation assuming a mixed Poisson-Gaussian noise model as:

    preprocess.algorithms.anscombe.gen_anscombe_forward(…)

    preprocess.algorithms.anscombe.gen_anscombe_forward(...)

    Applies the generalized Anscombe variance-stabilization transform assuming a mixed Poisson-Gaussian noise model as:

    preprocess.algorithms.anscombe.gen_anscombe_inverse_closed_form(…)

    preprocess.algorithms.anscombe.gen_anscombe_inverse_closed_form(...)

    Applies a closed-form approximation of the exact unbiased inverse of the generalized Anscombe variance-stabilizing transformation assuming a mixed Poisson-Gaussian noise model as:

    preprocess.algorithms.anscombe.gen_anscombe_inverse_exact_unbiased(…)

    preprocess.algorithms.anscombe.gen_anscombe_inverse_exact_unbiased(...)

    Applies an exact, unbiased inverse of the generalized Anscombe variance-stabilizing transformation assuming a mixed Poisson-Gaussian noise model as:

    preprocess.algorithms.arpls.ArPlsCvxopt([…])

    preprocess.algorithms.arpls.ArPlsCvxopt([...])

    preprocess.crop.ZeroColumn([first_or_last, …])

    Set first or last column that is not all 0’s to 0.

    preprocess.crop.ZeroColumn([first_or_last, ...])

    Set first or last column that is not all 0's to 0.

    preprocess.crop.ZeroRow([first_or_last, …])

    Set first or last row that is not all 0’s to 0.

    preprocess.crop.ZeroRow([first_or_last, ...])

    Set first or last row that is not all 0's to 0.

    preprocess.denoise.SVDDecompose([rng])

    Compute the SVD of a signal (just wraps numpy.linalg.svd) i.e., decompose the input into components.

    preprocess.denoise.SVDRecompose([rng])

    Reconstruct the original data using the SVD components.

    preprocess.standardize.Anscombe(gauss_std[, …])

    preprocess.standardize.Anscombe(gauss_std[, ...])

    Implement the generalized forward Anscombe transformation.

    preprocess.standardize.AnscombeInverse(gauss_std)

    Applies an exact, unbiased inverse of the generalized Anscombe variance-stabilizing transformation assuming a mixed Poisson-Gaussian noise model as:

    preprocess.subtract_baseline.SubtractBaselineALS([…])

    preprocess.subtract_baseline.SubtractBaselineALS([...])

    Subtract baseline using asymmetric least squares algorithm

    preprocess.subtract_dark.SubtractDark(dark)

    -
    -
    -
    + + +

    crikit.utils: Utility functions

    -
    +

    Classes

    @@ -264,12 +257,12 @@

    Classes

    - +

    utils.breadcrumb.BCPre([offset])

    Container that describes processing steps (ie it contains “breadcrumbs”)

    Container that describes processing steps (ie it contains "breadcrumbs")

    -
    -
    +
    +

    Functions

    @@ -277,13 +270,13 @@

    Functions

    - + - + @@ -306,9 +299,9 @@

    Functions @@ -317,8 +310,9 @@

    Functions
    -

    Table of Contents

    -
    @@ -54,7 +53,7 @@

    Navigation



    -
    +

    Walk-Thru: CRI Processing

    This walk-thru will take you through several steps:

    -
    + +

    Generating the built-in Raman/BCARS numerical phantom

    CRIkit2 comes with a built-in numerical phantom, which is dervived from an actual BCARS image collected from murine pancreas tissue [Camp16]. This @@ -152,8 +151,8 @@

    Generating the built-in Raman/BCARS numerical phantomView >> NRB Spect) and the Dark spectrum is loaded (View >> Dark Spect).

    _images/Overview_post_gen_BCARS.png -

    -
    + +

    Viewing dark, NRB, and dataset spectra

    To view the loaded Dark spectrum(a):

      @@ -186,8 +185,8 @@

      Viewing dark, NRB, and dataset spectra -

    -
    + +

    Dark subtraction

    The dark signal is the intrinsic signal level generated by the detector, even when no photons are incident on the detector. Typically, a measurement is made @@ -206,8 +205,8 @@

    Dark subtraction -

    -
    + +

    Variance stabilization

    CRIkit2 provides variance stabilitization through the forward Anscombe transformation that enables signals with mixed additive white Gaussian noise @@ -240,8 +239,8 @@

    Variance stabilization

    Poisson noise gain: 1.4

    _images/Anscombe.png -

    -
    + +

    Denoising via singular value decomposition (SVD)

    SVD is a linear algebra method that transforms a matrix into the multiplication of three matrices: the left-singular vectors matrix, the singular value matrix, @@ -269,8 +268,8 @@

    Denoising via singular value decomposition (SVD)

    Note: The example spectra are before Anscombe-SVD; and after Anscombe-SVD-inverse Anscombe.

    -

    -
    + +

    The inverse Anscombe transformation

    CRIkit2 provides an exact, unbiased inverse of the generalized Anscombe variance-stabilizing transform to convert the variance-stabilized image @@ -287,8 +286,8 @@

    The inverse Anscombe transformation +

    +

    Phase retrieval via Kramers-Kronig relation

    In CRI imagery acquired through CARS methods, phase retrieval methods are used to separate CARS and NRB signal contribution, i.e. to extract the Raman @@ -328,8 +327,8 @@

    Phase retrieval via Kramers-Kronig relation +

    +

    Phase error correction

    The KK relation will extract Raman signatures accurately under certain conditions, one being that the NRB can be separately measured and provided – at every @@ -393,8 +392,8 @@

    Phase error correction

    When finished press Ok pushbutton.

    _images/ALS.png -

    -
    + +

    Scale error correction

    The use of a reference (i.e., non-exact) NRB results in amplitude and phase error. Phase error correction and scale error correction correct @@ -427,8 +426,8 @@

    Scale error correction

    When finished press Ok pushbutton.

    _images/SG.png -

    -
    + +

    Calibration

    CRIkit2 provides a UI for single-peak calibration that properly accounts for the nonlinear relationship between wavenumber and wavelength (i.e. what @@ -455,12 +454,12 @@

    Calibration -

    - -
    + +

    Pseudo-color imagery

    Nuclei:

      @@ -528,37 +527,37 @@

      Pseudo-color imagery _images/Elastin.png _images/CompositeColorExample.png -

    -
    + +

    Skipped actions in a normal CRI workflow

    -
    +

    Loading HDF file Hsi dataset

    _images/Open.png -
    -
    +
    +

    Loading Dark dataset

    _images/OpenDark.png -
    -
    + +

    Denoise Dark (Optional)

    _static/cri_wt/denoise_dark.jpg -
    -
    + +

    Loading an NRB from HDF file

    _images/OpenNRB.png -
    -
    + +

    Load an NRB from a region-of-interest (ROI)

    _images/load_nrb_roi.jpg -
    -
    + +

    Merge two NRB datasets

    -
    -
    + +

    Residual dark subtraction (Optional)

    -
    - -
    + + +

    References

    Camp14(1,2)
    @@ -612,8 +611,8 @@

    References

    @@ -622,8 +621,9 @@

    References
    -

    Table of Contents

    -
    @@ -36,14 +35,14 @@

    Navigation

    -
    +

    crikit.cri.algorithms package

    -
    +

    Submodules

    -
    -
    +
    +

    crikit.cri.algorithms.kk module

    -
    +

    Kramers-Kronig Relation Phase Retrieval (crikit.process.maths.kk)

    kkrelation : Retrieve real and imaginary components from a @@ -57,8 +56,8 @@

    Kramers-Kronig Relation Phase Retrieval (crikit.process.maths.kk) -
    -crikit.cri.algorithms.kk.hilbertfft(y, pad_factor=1, n_edge=1, axis=- 1, copy=True, bad_value=1e-08, min_value=None, return_pad=False, **kwargs)[source]
    +
    +crikit.cri.algorithms.kk.hilbertfft(y, pad_factor=1, n_edge=1, axis=- 1, copy=True, bad_value=1e-08, min_value=None, return_pad=False, **kwargs)[source]

    Compute the one-dimensional Hilbert Transform.

    This function computes the one-dimentional Hilbert transform using the Fourier-domain implementation.

    @@ -106,8 +105,8 @@

    Kramers-Kronig Relation Phase Retrieval (crikit.process.maths.kk) -
    -crikit.cri.algorithms.kk.kkrelation(bg, cri, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad_factor=1, n_edge=1, axis=- 1, no_iter=False, bad_value=1e-08, min_value=None, hilb_kwargs={}, **kwargs)[source]
    +
    +crikit.cri.algorithms.kk.kkrelation(bg, cri, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad_factor=1, n_edge=1, axis=- 1, no_iter=False, bad_value=1e-08, min_value=None, hilb_kwargs={}, **kwargs)[source]

    Retrieve the real and imaginary components of a CRI spectra(um) via the Kramers-Kronig (KK) relation.

    @@ -148,12 +147,12 @@

    Kramers-Kronig Relation Phase Retrieval (crikit.process.maths.kk) +

    +
    +

    Module contents

    -
    -
    + +
    @@ -162,8 +161,9 @@

    Kramers-Kronig Relation Phase Retrieval (crikit.process.maths.kk)
    -

    Table of Contents

    -
    @@ -36,9 +35,9 @@

    Navigation

    -
    +

    crikit.cri package

    -
    +

    Subpackages

      @@ -64,17 +63,17 @@

      Subpackages +

    +

    Submodules

    -
    -
    +
    +

    crikit.cri.error_correction module

    Created on Mon Jun 6 11:20:35 2016

    @author: chc

    -
    -class crikit.cri.error_correction.PhaseErrCorrectALS(wavenumber_increasing=True, smoothness_param=1, asym_param=0.01, redux=10, order=2, rng=None, fix_end_points=False, fix_rng=None, fix_const=1, max_iter=100, min_diff=1e-05, verbose=True, **kwargs)[source]
    +
    +class crikit.cri.error_correction.PhaseErrCorrectALS(wavenumber_increasing=True, smoothness_param=1, asym_param=0.01, redux=10, order=2, rng=None, fix_end_points=False, fix_rng=None, fix_const=1, max_iter=100, min_diff=1e-05, verbose=True, **kwargs)[source]

    Bases: object

    Phase error correction (PEC) using asymmetric least squares (ALS).

    @@ -123,20 +122,20 @@

    Submodules -
    -calculate(data, **kwargs)[source]
    +
    +calculate(data, **kwargs)[source]

    -
    -transform(data, **kwargs)[source]
    +
    +transform(data, **kwargs)[source]
    -
    -class crikit.cri.error_correction.ScaleErrCorrectSG(win_size=601, order=2, rng=None)[source]
    +
    +class crikit.cri.error_correction.ScaleErrCorrectSG(win_size=601, order=2, rng=None)[source]

    Bases: object

    Scale error correction using Savitky-Golay

    References

    @@ -144,19 +143,19 @@

    Submodules -
    -calculate(data)[source]
    +
    +calculate(data)[source]

    -
    -transform(data)[source]
    +
    +transform(data)[source]
    -
    -
    + +

    crikit.cri.kk module

    Kramers-Kronig relation phase retrieval.

    References

    @@ -165,8 +164,8 @@

    Submodules -
    -class crikit.cri.kk.KramersKronig(cars_amp_offset=0.0, nrb_amp_offset=0.0, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad_factor=1, rng=None, n_edge=1, axis=- 1, bad_value=1e-08, min_value=None, hilb_kwargs={}, **kwargs)[source]
    +
    +class crikit.cri.kk.KramersKronig(cars_amp_offset=0.0, nrb_amp_offset=0.0, conjugate=False, phase_offset=0.0, norm_to_nrb=True, pad_factor=1, rng=None, n_edge=1, axis=- 1, bad_value=1e-08, min_value=None, hilb_kwargs={}, **kwargs)[source]

    Bases: object

    Retrieve the real and imaginary components of coherent Raman data via the Kramers-Kronig (KK) relation. See References.

    @@ -212,8 +211,8 @@

    Submodules -
    -calculate(cars, nrb)[source]
    +
    +calculate(cars, nrb)[source]

    cars : ndarray Coherent Raman signal.

    @@ -222,46 +221,46 @@

    Submodules -
    -property norm_to_nrb
    +
    +
    +property norm_to_nrb
    -
    -
    -property pad_factor
    +
    +
    +property pad_factor
    -
    -
    -property phase_offset
    +
    +
    +property phase_offset

    Phase offset

    -

    -
    + +

    crikit.cri.merge_nrbs module

    Created on Wed Nov 2 11:04:43 2016

    @author: chc

    -
    -class crikit.cri.merge_nrbs.MergeNRBs(nrb_left, nrb_right, pix, left_side_scale=True)[source]
    +
    +class crikit.cri.merge_nrbs.MergeNRBs(nrb_left, nrb_right, pix, left_side_scale=True)[source]

    Bases: object

    Merge two NRBs: a left-side and a right-side

    -
    -calculate()[source]
    +
    +calculate()[source]
    -
    -
    + +

    Module contents

    -
    -
    + +
    @@ -270,8 +269,9 @@

    Submodules
    -

    Table of Contents

    -
    @@ -36,191 +35,191 @@

    Navigation

    -
    +

    crikit.cri.tests package

    -
    +

    Submodules

    -
    -
    +
    +

    crikit.cri.tests.test_hilbert module

    Testing for Hilbert transform method

    Using the math relation a^2 / (a^2 + x^2) (Lorentz/Cauchy) has an analytical Hilbert transform: x^2 / (a^2 + x^2)

    -
    -crikit.cri.tests.test_hilbert.test_hilbert_in_place()[source]
    +
    +crikit.cri.tests.test_hilbert.test_hilbert_in_place()[source]
    -
    -crikit.cri.tests.test_hilbert.test_hilbert_no_pad()[source]
    +
    +crikit.cri.tests.test_hilbert.test_hilbert_no_pad()[source]
    -
    -crikit.cri.tests.test_hilbert.test_hilbert_pad()[source]
    +
    +crikit.cri.tests.test_hilbert.test_hilbert_pad()[source]
    -
    -crikit.cri.tests.test_hilbert.test_hilbert_replace_min_value()[source]
    +
    +crikit.cri.tests.test_hilbert.test_hilbert_replace_min_value()[source]
    -
    -
    + +

    crikit.cri.tests.test_kk module

    Testing for Kramers-Kronig Phase Retrieval Method

    Using the math relation a^2 / (a^2 + x^2) (Lorentz/Cauchy) has an analytical Hilbert transform: x^2 / (a^2 + x^2)– and how that plays into the KK

    -
    -crikit.cri.tests.test_kk.test_kk()[source]
    +
    +crikit.cri.tests.test_kk.test_kk()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_no_bg_norm()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_no_bg_norm()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_properties_read()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_properties_read()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_properties_setter()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_properties_setter()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_rng()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_rng()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_transform()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_transform()[source]
    -
    -crikit.cri.tests.test_kk.test_kk_transform_fail()[source]
    +
    +crikit.cri.tests.test_kk.test_kk_transform_fail()[source]
    -
    -
    + +

    crikit.cri.tests.test_kk_alg module

    Testing for Kramers-Kronig Phase Retrieval Method

    Using the math relation a^2 / (a^2 + x^2) (Lorentz/Cauchy) has an analytical Hilbert transform: x^2 / (a^2 + x^2)– and how that plays into the KK

    -
    -crikit.cri.tests.test_kk_alg.test_kk()[source]
    +
    +crikit.cri.tests.test_kk_alg.test_kk()[source]
    -
    -crikit.cri.tests.test_kk_alg.test_kk_3d()[source]
    +
    +crikit.cri.tests.test_kk_alg.test_kk_3d()[source]
    -
    -crikit.cri.tests.test_kk_alg.test_kk_conjugate()[source]
    +
    +crikit.cri.tests.test_kk_alg.test_kk_conjugate()[source]
    -
    -crikit.cri.tests.test_kk_alg.test_kk_no_bg_norm()[source]
    +
    +crikit.cri.tests.test_kk_alg.test_kk_no_bg_norm()[source]
    -
    -
    + +

    crikit.cri.tests.test_merge_nrbs module

    -
    -crikit.cri.tests.test_merge_nrbs.test_basic()[source]
    +
    +crikit.cri.tests.test_merge_nrbs.test_basic()[source]
    -
    -
    + +

    crikit.cri.tests.test_pec module

    Testing Phase error correction

    -
    -crikit.cri.tests.test_pec.test_basic()[source]
    +
    +crikit.cri.tests.test_pec.test_basic()[source]
    -
    -crikit.cri.tests.test_pec.test_basic2D()[source]
    +
    +crikit.cri.tests.test_pec.test_basic2D()[source]
    -
    -crikit.cri.tests.test_pec.test_basic3D()[source]
    +
    +crikit.cri.tests.test_pec.test_basic3D()[source]
    -
    -crikit.cri.tests.test_pec.test_fix_ends()[source]
    +
    +crikit.cri.tests.test_pec.test_fix_ends()[source]
    -
    -crikit.cri.tests.test_pec.test_fix_rng()[source]
    +
    +crikit.cri.tests.test_pec.test_fix_rng()[source]
    -
    -crikit.cri.tests.test_pec.test_rng()[source]
    +
    +crikit.cri.tests.test_pec.test_rng()[source]
    -
    -crikit.cri.tests.test_pec.test_rng_redux()[source]
    +
    +crikit.cri.tests.test_pec.test_rng_redux()[source]
    -
    -crikit.cri.tests.test_pec.test_rng_redux2D()[source]
    +
    +crikit.cri.tests.test_pec.test_rng_redux2D()[source]
    -
    -crikit.cri.tests.test_pec.test_rng_redux3D()[source]
    +
    +crikit.cri.tests.test_pec.test_rng_redux3D()[source]
    -
    -crikit.cri.tests.test_pec.test_transform_rng()[source]
    +
    +crikit.cri.tests.test_pec.test_transform_rng()[source]
    -
    -
    + +

    crikit.cri.tests.test_sec module

    Testing scale error correction

    -
    -crikit.cri.tests.test_sec.test_basic()[source]
    +
    +crikit.cri.tests.test_sec.test_basic()[source]
    -
    -crikit.cri.tests.test_sec.test_basic_transform()[source]
    +
    +crikit.cri.tests.test_sec.test_basic_transform()[source]
    -
    -crikit.cri.tests.test_sec.test_rng()[source]
    +
    +crikit.cri.tests.test_sec.test_rng()[source]
    -
    -
    + +

    Module contents

    -
    -
    + +
    @@ -229,8 +228,9 @@

    Submodules
    -

    Table of Contents

    -
    @@ -36,9 +36,9 @@

    Navigation

    -
    +

    crikit.data package

    -
    +

    Subpackages

      @@ -55,19 +55,19 @@

      Subpackages +

    +

    Submodules

    -
    -
    +
    +

    crikit.data.factorized module

    Factored data class

    Created on Fri Apr 22 23:42:40 2016

    @author: chc

    -
    -class crikit.data.factorized.FactorizedHsi[source]
    -

    Bases: crikit.data.hsi.Hsi, crikit.data.factorized._Factorized

    +
    +class crikit.data.factorized.FactorizedHsi[source]
    +

    Bases: crikit.data.spectra.Hsi, crikit.data.factorized._Factorized

    Factorized Hsi Class

    Notes

    +

    crikit.data.frequency module

    “Frequency” [,wavelength, and wavenumber] class and function.

    -
    -class crikit.data.frequency.Frequency(data=None, calib=None, calib_orig=None, calib_fcn=None, units=None)[source]
    +
    +class crikit.data.frequency.Frequency(data=None, calib=None, calib_orig=None, calib_fcn=None, units=None)[source]

    Bases: object

    Frequency [,wavelength, and wavenumber] class

    -
    -data
    +
    +data

    Frequency vector

    Type
    @@ -107,8 +107,8 @@

    Submodules -
    -calib
    +
    +calib

    Calibration object that is passed to calib_fcn

    Type
    @@ -118,8 +118,8 @@

    Submodules -
    -calib_orig
    +
    +calib_orig

    Calibration object (‘original’). Set during initial setting of calib. Useful for backing-up calibration)

    Type
    @@ -129,8 +129,8 @@

    Submodules -
    -calib_fcn
    +
    +calib_fcn

    Function that accepts a calibration object and returns data and units

    Type
    @@ -140,8 +140,8 @@

    Submodules -
    -units
    +
    +units

    Units of data (the default is ‘Frequency’). Over-written by return from calib_fcn

    Type
    @@ -151,8 +151,8 @@

    Submodules -
    -op_list_pix
    +
    +op_list_pix

    Range of pixels to perform operations over. Must be even lengthed.

    Type
    @@ -162,8 +162,8 @@

    Submodules -
    -op_list_freq
    +
    +op_list_freq

    Range of frequencies (or wavelength, or wavenumber) to perform operations over. Must be even lengthed.

    Type
    @@ -173,8 +173,8 @@

    Submodules -
    -plot_list_pix
    +
    +plot_list_pix

    Range of pixels to plot. Must be even lengthed.

    Type
    @@ -184,8 +184,8 @@

    Submodules -
    -plot_list_freq
    +
    +plot_list_freq

    Range of frequencies (or wavelength, or wavenumber) to plot. Must be even lengthed.

    Type
    @@ -195,8 +195,8 @@

    Submodules -
    -size
    +
    +size

    Length of data

    Type
    @@ -206,8 +206,8 @@

    Submodules -
    -pix_vec
    +
    +pix_vec

    Pixel vector (0-indexed)

    Type
    @@ -217,8 +217,8 @@

    Submodules -
    -op_range_freq
    +
    +op_range_freq

    Range of operarational frequencies

    Type
    @@ -228,8 +228,8 @@

    Submodules -
    -plot_range_freq
    +
    +plot_range_freq

    Range of printing frequencies (not implemented)

    Type
    @@ -239,21 +239,21 @@

    Submodules -
    -update()[source]
    +
    +update()[source]

    Updates data based on contents of calib (or calib_orig) and calib_fcn

    -
    -get_index_of_closest_freq()[source]
    +
    +get_index_of_closest_freq()[source]

    Find the closest frequency in freq to a given freq value and RETURN the pixel value.

    -
    -get_closest_freq()[source]
    +
    +get_closest_freq()[source]

    Find the closest frequency in freq to a given freq value.

    @@ -267,99 +267,99 @@

    Submodules -
    -property calib
    +
    +
    +property calib
    -
    -
    -property calib_fcn
    +
    +
    +property calib_fcn
    -
    -
    -property calib_orig
    +
    +
    +property calib_orig
    -
    -
    -property data
    +
    +
    +property data
    -
    -get_closest_freq(in_freqs)[source]
    +
    +get_closest_freq(in_freqs)[source]

    Return frequency(-ies) in freq closest to in_freqs

    -
    -get_index_of_closest_freq(in_freqs)[source]
    +
    +get_index_of_closest_freq(in_freqs)[source]

    Return index(-es) of frequency(-ies) in freq closest to in_freqs

    -
    -
    -property op_list_freq
    +
    +
    +property op_list_freq
    -
    -
    -property op_list_pix
    +
    +
    +property op_list_pix
    -
    -
    -property op_range_freq
    +
    +
    +property op_range_freq
    -
    -
    -property op_range_pix
    +
    +
    +property op_range_pix
    -
    -
    -property op_size
    +
    +
    +property op_size
    -
    -
    -property pix_vec
    +
    +
    +property pix_vec
    -
    -
    -property plot_list_freq
    +
    +
    +property plot_list_freq
    -
    -
    -property plot_list_pix
    +
    +
    +property plot_list_pix
    -
    -
    -property size
    +
    +
    +property size
    -
    -
    -property units
    +
    +
    +property units
    -
    -update()[source]
    +
    +update()[source]

    Update data with calib and calib_fcn.

    -
    -crikit.data.frequency.calib_pix_wl(calib_obj)[source]
    +
    +crikit.data.frequency.calib_pix_wl(calib_obj)[source]

    Return a wavelength (wl) vector based on calibration (calib) object

    Parameters
    @@ -373,7 +373,7 @@

    SubmodulesReturns

    • wl_vec (1D ndarray) – Wavelength vector

    • -
    • units (str) – Units string ‘Wavelength (‘ + calib_obj[‘units’] + ‘)’

    • +
    • units (str) – Units string ‘Wavelength (’ + calib_obj[‘units’] + ‘)’

    @@ -395,8 +395,8 @@

    Submodules -
    -crikit.data.frequency.calib_pix_wn(calib_obj)[source]
    +
    +crikit.data.frequency.calib_pix_wn(calib_obj)[source]

    Return a wavenumber (wn) vector based on calibration (calib) object

    Parameters
    @@ -438,137 +438,12 @@

    Submodules -

    crikit.data.hsi module

    -

    Hyperspectral imagery (hsi) class

    -

    Created on Tue Apr 12 13:06:30 2016

    -

    @author: chc

    -
    -
    -class crikit.data.hsi.Hsi(data=None, freq=None, x=None, y=None, x_rep=None, y_rep=None, label=None, units=None, meta=None)[source]
    -

    Bases: crikit.data.spectrum.Spectrum

    -

    Hyperspectral imagery class

    -
    -
    Parameters
    -
      -
    • data (3D ndarray [y_pix, x_pix, f_pix]) – HSI image

    • -
    • mask (3D ndarray (int) [y_pix, x_pix, f_pix]) – 0,1 mask with 1 is a usable pixel and 0 is not

    • -
    • freq (crikit.data.frequency.Frequency instance) – Frequency [wavelength, wavenumber] object (i.e., the independent variable)

    • -
    • label (str) – Image label (i.e., a string describing what the image is)

    • -
    • units (str) – Units of image (e.g., intensity)

    • -
    • x_rep (crikit.data.replicate.Replicate instance, Not implemented yet) – x-axis spatial object

    • -
    • y_rep (crikit.data.replicate.Replicate instance, Not implemented yet) – x-axis spatial object

    • -
    • x (1D ndarray) – x-axis spatial vector

    • -
    • y (1D ndarray) – y-axis spatial vector

    • -
    • meta (dict) – Meta-data dictionary

    • -
    -
    -
    -
    -
    -shape
    -

    Shape of data

    -
    -
    Type
    -

    tuple, read-only

    -
    -
    -
    - -
    -
    -size
    -

    Size of data (i.e., total number of entries)

    -
    -
    Type
    -

    int, read-only

    -
    -
    -
    - -
    -
    -mean : 1D ndarray
    -

    Mean spectrum. If extent [a,b] is provided, calculate mean over that inclusive region.

    -
    - -
    -
    -std : 1D ndarray
    -

    Standard deviation of spectrum. If extent [a,b] is provided, calculate standard deviation over that inclusive region.

    -
    - -
    -
    -subtract : 3D ndarray or None
    -

    Subtract spectrum or object

    -
    - -

    Notes

    -
      -
    • freq object contains some useful parameters such as op_range_* and plot_range_*, which define spectral regions-of-interest. (It’s debatable as to whether those parameters should be in Frequency or Spectrum classes)

    • -
    -
    -
    -check()[source]
    -

    Check x, y, and freq to make sure the dimensions agree with data

    -
    - -
    -
    -config = {'nd_axis': -1}
    -
    - -
    -
    -property data
    -
    - -
    -
    -get_rand_spectra(num, pt_sz=1, quads=False, full=False)[source]
    -
    - -
    -
    -property mask
    -
    - -
    -
    -subtract(spectra, overwrite=True)[source]
    -

    Subtract spectrum from data

    -
    - -
    -
    -property x
    -
    - -
    -
    -property x_rep
    -
    - -
    -
    -property y
    -
    - -
    -
    -property y_rep
    -
    - -
    - -

    -
    + +

    crikit.data.mosaic module

    -
    -class crikit.data.mosaic.Mosaic[source]
    +
    +class crikit.data.mosaic.Mosaic[source]

    Bases: object

    Mosaic Class

    Notes

    @@ -578,97 +453,97 @@

    Submodules -
    -append(obj)[source]
    +
    +append(obj)[source]

    Append new object to data. Check dimensions

    -
    -attr_dict(prefix='Mosaic.')[source]
    +
    +attr_dict(prefix='Mosaic.')[source]
    -
    -
    -property dtype
    +
    +
    +property dtype

    Return the highest dtype

    -
    -
    -property is2d
    +
    +
    +property is2d
    -
    -
    -property is3d
    +
    +
    +property is3d
    -
    -
    -property issamedim
    +
    +
    +property issamedim
    -
    -mosaic2d(shape=None, idx=None, out=None)[source]
    +
    +mosaic2d(shape=None, idx=None, out=None)[source]

    Return 2D mosaic image

    -
    -mosaic_mask(shape=None, out=None)[source]
    +
    +mosaic_mask(shape=None, out=None)[source]

    Returns a 2D mosaic image with integer values for which img is where

    -
    -mosaic_shape(shape=None, idx=None)[source]
    +
    +mosaic_shape(shape=None, idx=None)[source]

    Return the shape of a would-be mosaic

    -
    -mosaicfull(shape=None, out=None)[source]
    +
    +mosaicfull(shape=None, out=None)[source]

    Return full mosaic

    -
    -
    -property shape
    +
    +
    +property shape
    -
    -
    -property size
    +
    +
    +property size
    -
    -
    -property unitshape
    +
    +
    +property unitshape
    -
    -
    -property unitshape_orig
    +
    +
    +property unitshape_orig
    -
    -
    + +

    crikit.data.replicate module

    Replicate class used for things such as repetitive measurements or even spatial vectors (e.g., x and y)

    Created on Tue Apr 12 11:42:56 2016

    @author: chc

    -
    -class crikit.data.replicate.Replicate(data=None, calib=None, units=None, label=None)[source]
    +
    +class crikit.data.replicate.Replicate(data=None, calib=None, units=None, label=None)[source]

    Bases: object

    Replicate class

    -
    -data
    +
    +data

    Replicate data

    Type
    @@ -678,8 +553,8 @@

    Submodules -
    -calib
    +
    +calib

    Calibration descriptor. See Note.

    Type
    @@ -689,8 +564,8 @@

    Submodules -
    -units
    +
    +units

    Units of replicate data

    Type
    @@ -700,8 +575,8 @@

    Submodules -
    -size
    +
    +size
    Type

    int, read-only

    @@ -710,20 +585,20 @@

    Submodules -
    -update_calib_from_data()[source]
    +
    +update_calib_from_data()[source]

    Calculate and set calib parameter from data

    -
    -update_data_from_calib()[source]
    +
    +update_data_from_calib()[source]

    Calculate and set data from calib parameter

    -
    -calib_data_agree()[source]
    +
    +calib_data_agree()[source]

    Return bool as to whether data and that derived from calib agree

    @@ -739,63 +614,198 @@

    Submodules -
    -property calib
    +
    +
    +property calib
    -
    -calib_data_agree()[source]
    +
    +calib_data_agree()[source]
    -
    -
    -property data
    +
    +
    +property data
    -
    -
    -property label
    +
    +
    +property label
    -
    -
    -property size
    +
    +
    +property size
    -
    -
    -property units
    +
    +
    +property units
    -
    -update_calib_from_data()[source]
    +
    +update_calib_from_data()[source]

    Calculate and set calib parameter from data. Note: assumes uniform spacing of data.

    -
    -update_data_from_calib()[source]
    +
    +update_data_from_calib()[source]

    Calculate and set data from calib parameter

    -

    -
    + +

    crikit.data.spectra module

    Spectra class and function (very similar to Spetcrum except this deals with multiple entries)

    -
    -class crikit.data.spectra.Spectra(data=None, freq=None, label=None, units=None, meta=None)[source]
    -

    Bases: crikit.data.spectrum.Spectrum

    +
    +class crikit.data.spectra.Hsi(data=None, freq=None, x=None, y=None, x_rep=None, y_rep=None, label=None, units=None, meta=None)[source]
    +

    Bases: crikit.data.spectra.Spectrum

    +

    Hyperspectral imagery class

    +
    +
    Parameters
    +
      +
    • data (3D ndarray [y_pix, x_pix, f_pix]) – HSI image

    • +
    • mask (3D ndarray (int) [y_pix, x_pix, f_pix]) – 0,1 mask with 1 is a usable pixel and 0 is not

    • +
    • freq (crikit.data.frequency.Frequency instance) – Frequency [wavelength, wavenumber] object (i.e., the independent variable)

    • +
    • label (str) – Image label (i.e., a string describing what the image is)

    • +
    • units (str) – Units of image (e.g., intensity)

    • +
    • x_rep (crikit.data.replicate.Replicate instance, Not implemented yet) – x-axis spatial object

    • +
    • y_rep (crikit.data.replicate.Replicate instance, Not implemented yet) – x-axis spatial object

    • +
    • x (1D ndarray) – x-axis spatial vector

    • +
    • y (1D ndarray) – y-axis spatial vector

    • +
    • meta (dict) – Meta-data dictionary

    • +
    +
    +
    +
    +
    +shape
    +

    Shape of data

    +
    +
    Type
    +

    tuple, read-only

    +
    +
    +
    + +
    +
    +size
    +

    Size of data (i.e., total number of entries)

    +
    +
    Type
    +

    int, read-only

    +
    +
    +
    + +
    +
    +extent
    +

    Extent of image [xmin, xmax, ymin, ymax]

    +
    +
    Type
    +

    list, read-only

    +
    +
    +
    + +
    +
    +mean : 1D ndarray
    +

    Mean spectrum. If extent [a,b] is provided, calculate mean over that inclusive region.

    +
    + +
    +
    +std : 1D ndarray
    +

    Standard deviation of spectrum. If extent [a,b] is provided, calculate standard deviation over that inclusive region.

    +
    + +
    +
    +subtract : 3D ndarray or None
    +

    Subtract spectrum or object

    +
    + +

    Notes

    +
      +
    • freq object contains some useful parameters such as op_range_* and plot_range_*, which define spectral regions-of-interest. (It’s debatable as to whether those parameters should be in Frequency or Spectrum classes)

    • +
    +
    +
    +check()[source]
    +

    Check x, y, and freq to make sure the dimensions agree with data

    +
    + +
    +
    +config = {'nd_axis': -1}
    +
    + +
    +
    +property data
    +
    + +
    +
    +property extent
    +
    + +
    +
    +get_rand_spectra(num, pt_sz=1, quads=False, full=False)[source]
    +
    + +
    +
    +property mask
    +
    + +
    +
    +subtract(spectra, overwrite=True)[source]
    +

    Subtract spectrum from data

    +
    + +
    +
    +property x
    +
    + +
    +
    +property x_rep
    +
    + +
    +
    +property y
    +
    + +
    +
    +property y_rep
    +
    + +
    + +
    +
    +class crikit.data.spectra.Spectra(data=None, freq=None, label=None, units=None, meta=None)[source]
    +

    Bases: crikit.data.spectra.Spectrum

    Spectra class

    -
    -data
    +
    +data

    Spectra. Note: input can be a ndarray of any dimension: it will be CONVERTED to [n_pix, f_pix] shape, assuming that shape[-1] is the f_pix long.

    Type
    @@ -805,8 +815,8 @@

    Submodules -
    -freq
    +
    +freq

    Frequency [wavelength, wavenumber] object (i.e., the independent variable)

    Type
    @@ -816,8 +826,8 @@

    Submodules -
    -label
    +
    +label

    Spectrum label (i.e., a string describing what the spectrum is)

    Type
    @@ -827,8 +837,8 @@

    Submodules -
    -units
    +
    +units

    Units of spectrum

    Type
    @@ -838,8 +848,8 @@

    Submodules -
    -reps
    +
    +reps

    Object describing the meaning of multiple spectra (i.e., the physical meaning of n_pix).

    Type
    @@ -849,8 +859,8 @@

    Submodules -
    -meta
    +
    +meta

    Meta-data dictionary

    Type
    @@ -860,8 +870,8 @@

    Submodules -
    -shape
    +
    +shape

    Shape of data

    Type
    @@ -871,8 +881,8 @@

    Submodules -
    -n_pix
    +
    +n_pix

    Size of data’s replicate/spectral number axis.

    Type
    @@ -882,20 +892,20 @@

    Submodules -
    -mean : 1D ndarray
    +
    +mean : 1D ndarray

    Mean spectrum. If extent [a,b] is provided, calculate mean over that inclusive region.

    -
    -std : 1D ndarray
    +
    +std : 1D ndarray

    Standard deviation of spectrum. If extent [a,b] is provided, calculate standard deviation over that inclusive region.

    -
    -subtract : 2D ndarray or None
    +
    +subtract : 2D ndarray or None

    Subtract spectrum or object

    @@ -904,45 +914,41 @@

    Submodules -
    -config = {'nd_axis': -1}
    +
    +config = {'nd_axis': -1}

    -
    -
    -property data
    +
    +
    +property data
    -
    -
    -property n_pix
    +
    +
    +property n_pix
    -
    -
    -property reps
    +
    +
    +property reps
    -
    -subtract(spectra, overwrite=True)[source]
    +
    +subtract(spectra, overwrite=True)[source]

    Subtract spectrum from data

    -

    -
    -

    crikit.data.spectrum module

    -

    Spectrum class and function

    -
    -class crikit.data.spectrum.Spectrum(data=None, freq=None, label=None, units=None, meta=None)[source]
    +
    +class crikit.data.spectra.Spectrum(data=None, freq=None, label=None, units=None, meta=None)[source]

    Bases: object

    Spectrum class

    -
    -data
    +
    +data

    Spectrum

    Type
    @@ -952,8 +958,8 @@

    Submodules -
    -freq
    +
    +freq

    Frequency [wavelength, wavenumber] object (i.e., the independent variable)

    Type
    @@ -963,8 +969,8 @@

    Submodules -
    -label
    +
    +label

    Spectrum label (i.e., a string describing what the spectrum is)

    Type
    @@ -974,8 +980,8 @@

    Submodules -
    -units
    +
    +units

    Units of spectrum

    Type
    @@ -985,8 +991,8 @@

    Submodules -
    -meta
    +
    +meta

    Meta-data dictionary

    Type
    @@ -996,8 +1002,8 @@

    Submodules -
    -f_pix
    +
    +f_pix

    Size of data. Note: this matches the size of data and does NOT check the size of freq.freq_vec.

    Type
    @@ -1007,8 +1013,8 @@

    Submodules -
    -ndim
    +
    +ndim

    Number of data dimensions

    Type
    @@ -1018,8 +1024,8 @@

    Submodules -
    -shape
    +
    +shape

    Shape of data

    Type
    @@ -1029,8 +1035,8 @@

    Submodules -
    -size
    +
    +size

    Size of data (i.e., total number of entries)

    Type
    @@ -1040,20 +1046,20 @@

    Submodules -
    -mean : int
    +
    +mean : int

    Mean value. If extent [a,b] is provided, calculate mean over that inclusive region.

    -
    -std : int
    +
    +std : int

    Standard deviation. If extent [a,b] is provided, calculate standard deviation over that inclusive region.

    -
    -subtract : 1D ndarray or None
    +
    +subtract : 1D ndarray or None

    Subtract spectrum or object

    @@ -1062,18 +1068,18 @@

    Submodules -
    -config = {'nd_axis': -1, 'nd_fcn': <function mean>}
    +
    +config = {'nd_axis': -1, 'nd_fcn': <function mean>}

    -
    -
    -property data
    +
    +
    +property data
    -
    -
    -property f
    +
    +
    +property f

    return frequency vector within operating (op) range

    Type
    @@ -1082,9 +1088,9 @@

    Submodules -
    -property f_full
    +
    +
    +property f_full

    return full frequency vector

    Type
    @@ -1093,73 +1099,73 @@

    Submodules -
    -property f_pix
    +
    +
    +property f_pix
    -
    -
    -property freq
    +
    +
    +property freq
    -
    -
    -property label
    +
    +
    +property label
    -
    -mean(extent=None, over_space=True)[source]
    +
    +mean(extent=None, over_space=True)[source]

    Return mean spectrum (or mean over extent [list with 2 elements]). If over_space is False, returns reps-number of mean spectra

    -
    -
    -property meta
    +
    +
    +property meta
    -
    -
    -property ndim
    +
    +
    +property ndim
    -
    -
    -property shape
    +
    +
    +property shape
    -
    -
    -property size
    +
    +
    +property size
    -
    -std(extent=None, over_space=True)[source]
    +
    +std(extent=None, over_space=True)[source]

    Return standard deviation (std) spectrum (or std over extent [list with 2 elements]). If over_space is False, reps (or reps x reps) number of std’s.

    -
    -subtract(spectrum, overwrite=True)[source]
    +
    +subtract(spectrum, overwrite=True)[source]

    Subtract spectrum from data

    -
    -
    -property units
    +
    +
    +property units

    -

    -
    + +

    Module contents

    -
    -
    + +
    @@ -1168,23 +1174,23 @@

    Submodules
    -

    Table of Contents

    -
    @@ -36,167 +35,167 @@

    Navigation

    -
    +

    crikit.data.tests package

    -
    +

    Submodules

    -
    -
    +
    +

    crikit.data.tests.test_hsi module

    -
    -crikit.data.tests.test_hsi.make_datasets()[source]
    +
    +crikit.data.tests.test_hsi.make_datasets()[source]

    Setups and tears down a series of datasets

    -
    -crikit.data.tests.test_hsi.test_hsi_to_hsi(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_hsi_to_hsi(make_datasets)[source]

    Import an hsi into an hsi

    -
    -crikit.data.tests.test_hsi.test_hsi_to_hsi_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_hsi_to_hsi_rng(make_datasets)[source]

    Import an hsi into an hsi – defined range

    -
    -crikit.data.tests.test_hsi.test_mean_axes_static()[source]
    +
    +crikit.data.tests.test_hsi.test_mean_axes_static()[source]

    Ensure mean_axes_static raises an error

    -
    -crikit.data.tests.test_hsi.test_reshape_axes_static(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_reshape_axes_static(make_datasets)[source]

    Test reshape axes static method

    -
    -crikit.data.tests.test_hsi.test_spectra_to_hsi(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_spectra_to_hsi(make_datasets)[source]

    Import spectra into an hsi

    -
    -crikit.data.tests.test_hsi.test_spectra_to_hsi_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_spectra_to_hsi_rng(make_datasets)[source]

    Import spectra into an hsi – defined range

    -
    -crikit.data.tests.test_hsi.test_spectrum_to_hsi(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_spectrum_to_hsi(make_datasets)[source]

    Import a spectrum into an hsi

    -
    -crikit.data.tests.test_hsi.test_spectrum_to_hsi_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_hsi.test_spectrum_to_hsi_rng(make_datasets)[source]

    Import a spectrum into an hsi – defined range

    -
    -
    + +

    crikit.data.tests.test_mosaic module

    -
    -crikit.data.tests.test_mosaic.test_2D_uniform_obj()[source]
    +
    +crikit.data.tests.test_mosaic.test_2D_uniform_obj()[source]
    -
    -crikit.data.tests.test_mosaic.test_3D_crop_transpose_flips()[source]
    +
    +crikit.data.tests.test_mosaic.test_3D_crop_transpose_flips()[source]

    Test a 2D dataset with cropped rows and columns

    -
    -crikit.data.tests.test_mosaic.test_3D_crop_transpose_flips_2()[source]
    +
    +crikit.data.tests.test_mosaic.test_3D_crop_transpose_flips_2()[source]

    Test a 2D dataset with cropped rows and columns (asymmetrically)

    -
    -crikit.data.tests.test_mosaic.test_3D_uniform_obj()[source]
    +
    +crikit.data.tests.test_mosaic.test_3D_uniform_obj()[source]
    -
    -crikit.data.tests.test_mosaic.test_big_to_small_2d()[source]
    +
    +crikit.data.tests.test_mosaic.test_big_to_small_2d()[source]
    -
    -crikit.data.tests.test_mosaic.test_big_to_small_2d_2()[source]
    +
    +crikit.data.tests.test_mosaic.test_big_to_small_2d_2()[source]
    -
    -crikit.data.tests.test_mosaic.test_big_to_small_3d()[source]
    +
    +crikit.data.tests.test_mosaic.test_big_to_small_3d()[source]
    -
    -crikit.data.tests.test_mosaic.test_big_to_small_3d_2()[source]
    +
    +crikit.data.tests.test_mosaic.test_big_to_small_3d_2()[source]
    -
    -crikit.data.tests.test_mosaic.test_big_to_small_3d_output_given()[source]
    +
    +crikit.data.tests.test_mosaic.test_big_to_small_3d_output_given()[source]
    -
    -crikit.data.tests.test_mosaic.test_blank()[source]
    +
    +crikit.data.tests.test_mosaic.test_blank()[source]
    -
    -crikit.data.tests.test_mosaic.test_crop_2D()[source]
    +
    +crikit.data.tests.test_mosaic.test_crop_2D()[source]

    Test a 2D dataset with cropped rows and columns

    -
    -crikit.data.tests.test_mosaic.test_crop_3D()[source]
    +
    +crikit.data.tests.test_mosaic.test_crop_3D()[source]

    Test a 2D dataset with cropped rows and columns

    -
    -crikit.data.tests.test_mosaic.test_err_wrong_dim()[source]
    +
    +crikit.data.tests.test_mosaic.test_err_wrong_dim()[source]
    -
    -crikit.data.tests.test_mosaic.test_err_wrong_dim_append()[source]
    +
    +crikit.data.tests.test_mosaic.test_err_wrong_dim_append()[source]
    -
    -
    + +

    crikit.data.tests.test_mosaic_hdf module

    -
    -crikit.data.tests.test_mosaic_hdf.hdf_dataset2()[source]
    +
    +crikit.data.tests.test_mosaic_hdf.hdf_dataset2()[source]

    Setups and tears down a sample HDF5 file

    -
    -crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given()[source]
    +
    +crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given()[source]
    -
    -crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given_crop()[source]
    +
    +crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given_crop()[source]

    3D big dataset, divied up into small chunks – WITH CROPPING

    -
    -crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given_crop_transpose_flips()[source]
    +
    +crikit.data.tests.test_mosaic_hdf.test_big_to_small_3d_output_given_crop_transpose_flips()[source]

    3D big dataset, divied up into small chunks – WITH CROPPING, TRANSPOSING AND FLIPPING H & V

    Note: This test does not assert anything, but rather just ensures the methods @@ -204,126 +203,126 @@

    Submodules -
    -crikit.data.tests.test_mosaic_hdf.test_hdf2(hdf_dataset2)[source]
    +
    +crikit.data.tests.test_mosaic_hdf.test_hdf2(hdf_dataset2)[source]

    -
    -
    + +

    crikit.data.tests.test_spectra module

    -
    -crikit.data.tests.test_spectra.make_datasets()[source]
    +
    +crikit.data.tests.test_spectra.make_datasets()[source]

    Setups and tears down a series of datasets

    -
    -crikit.data.tests.test_spectra.test_hsi_to_spectra(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_hsi_to_spectra(make_datasets)[source]

    Import an hsi into spectra

    -
    -crikit.data.tests.test_spectra.test_hsi_to_spectra_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_hsi_to_spectra_rng(make_datasets)[source]

    Import an hsi into spectra – defined range

    -
    -crikit.data.tests.test_spectra.test_mean_axes_static()[source]
    +
    +crikit.data.tests.test_spectra.test_mean_axes_static()[source]

    Ensure mean_axes_static raises an error

    -
    -crikit.data.tests.test_spectra.test_reshape_axes_static(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_reshape_axes_static(make_datasets)[source]

    Test reshape axes static method

    -
    -crikit.data.tests.test_spectra.test_spectra_to_spectra(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_spectra_to_spectra(make_datasets)[source]

    Import a spectrum into a spectrum

    -
    -crikit.data.tests.test_spectra.test_spectra_to_spectra_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_spectra_to_spectra_rng(make_datasets)[source]

    Import spectra into spectra – defined range

    -
    -crikit.data.tests.test_spectra.test_spectrum_to_spectra(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_spectrum_to_spectra(make_datasets)[source]

    Import a spectrum into a spectrum

    -
    -crikit.data.tests.test_spectra.test_spectrum_to_spectra_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectra.test_spectrum_to_spectra_rng(make_datasets)[source]

    Import spectrum into spectra – defined range

    -
    -
    + +

    crikit.data.tests.test_spectrum module

    -
    -crikit.data.tests.test_spectrum.make_datasets()[source]
    +
    +crikit.data.tests.test_spectrum.make_datasets()[source]

    Setups and tears down a series of datasets

    -
    -crikit.data.tests.test_spectrum.test_hsi_to_spectrum(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_hsi_to_spectrum(make_datasets)[source]

    Import hsi into a spectrum

    -
    -crikit.data.tests.test_spectrum.test_hsi_to_spectrum_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_hsi_to_spectrum_rng(make_datasets)[source]

    Import an hsi into a spectrum – defined range

    -
    -crikit.data.tests.test_spectrum.test_mean_axes_static(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_mean_axes_static(make_datasets)[source]

    Import a spectrum into a spectrum

    -
    -crikit.data.tests.test_spectrum.test_spectra_to_spectrum(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_spectra_to_spectrum(make_datasets)[source]

    Import spectra into a spectrum

    -
    -crikit.data.tests.test_spectrum.test_spectra_to_spectrum_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_spectra_to_spectrum_rng(make_datasets)[source]

    Import spectra into a spectrum – defined range

    -
    -crikit.data.tests.test_spectrum.test_spectrum_to_spectrum(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_spectrum_to_spectrum(make_datasets)[source]

    Import a spectrum into a spectrum

    -
    -crikit.data.tests.test_spectrum.test_spectrum_to_spectrum_rng(make_datasets)[source]
    +
    +crikit.data.tests.test_spectrum.test_spectrum_to_spectrum_rng(make_datasets)[source]

    Import a spectrum into a spectrum – defined range

    -
    -
    + +

    crikit.data.tests.~test_data_indexing module

    -
    -
    + +

    Module contents

    -
    -
    + +
    @@ -332,8 +331,9 @@

    crikit.data.tests.~test_data_indexing module
    -

    Table of Contents

    -
    @@ -36,16 +35,16 @@

    Navigation

    -
    +

    crikit.datasets package

    -
    +

    Submodules

    -
    -
    +
    +

    crikit.datasets.model module

    -
    -class crikit.datasets.model.Model(subsample=1, dtype=<class 'complex'>)[source]
    +
    +class crikit.datasets.model.Model(subsample=1, dtype=<class 'complex'>)[source]

    Bases: object

    Model class

    @@ -56,26 +55,26 @@

    Submodules -
    -property f
    +
    +
    +property f
    -
    -
    -property hsi_i
    +
    +
    +property hsi_i

    Return imag{hsi}

    -
    -
    -property hsi_r
    +
    +
    +property hsi_r

    Return real{hsi}

    -
    -make_hsi(f=None)[source]
    +
    +make_hsi(f=None)[source]

    Make the HSI image

    Parameters
    @@ -85,8 +84,8 @@

    Submodules -
    -make_spectra(f)[source]
    +
    +make_spectra(f)[source]
    Parameters

    f (ndarray (1D)) – Frequency vector

    @@ -94,18 +93,18 @@

    Submodules -
    -property wn
    +
    +
    +property wn

    -

    -
    + +

    Module contents

    -
    -
    + +
    @@ -114,8 +113,9 @@

    Submodules
    -

    Table of Contents

    -
    @@ -36,9 +35,9 @@

    Navigation

    -
    +

    crikit package

    - -
    +
    +

    crikit.CRIkitUI module

    -
    +

    CRIKit2: Hyperspectral imaging toolkit

    CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral imaging (HSI) platform (user interface, UI).

    @@ -281,180 +290,191 @@

    CRIKit2: Hyperspectral imaging toolkit +

    Usage

    From ./crikit2 directory python3 main.py

    -

    -
    +
    +

    Authors

    -
    -class crikit.CRIkitUI.CRIkitUI_process(**kwargs)[source]
    +
    +class crikit.CRIkitUI.CRIkitUI_process(**kwargs)[source]

    Bases: PyQt5.QtWidgets.QMainWindow

    CRIkitUI_process : CRIkitUI for image (pre-)processing

    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.

    -
    -NUMCOLORS = 4
    +
    +NUMCOLORS = 4
    -
    -anscombe()[source]
    +
    +anscombe()[source]

    Performance Anscombe transformation

    -
    -calcAnscombeParams()[source]
    +
    +calcAnscombeParams()[source]

    Calculate Anscombe Parameters

    -
    -calibrate()[source]
    +
    +calibrate()[source]

    Calibrate spectra

    -
    -calibrationReset()[source]
    +
    +calibrationReset()[source]

    Set self.hsi.freqcalib back to self.hsi.freqcaliborig

    -
    -changeSlider()[source]
    +
    +changeSlider()[source]

    Respond to change in frequency slider

    -
    -checkCompositeUpdate(num)[source]
    +
    +checkCompositeUpdate(num)[source]

    Update color composite only if appropriate tab is selected.

    -
    -checkShowOverlays()[source]
    +
    +checkShowOverlays()[source]
    -
    -closeEvent(self, QCloseEvent)[source]
    +
    +closeEvent(self, QCloseEvent)[source]
    -
    -condInEqualityChange()[source]
    +
    +condInEqualityChange()[source]

    Conditional inequality changed.

    -
    -condOpChange()[source]
    +
    +condOpChange()[source]

    Conditional math operation performed on single-color images changed.

    -
    -createImgBW(img)[source]
    +
    +createImgBW(img)[source]

    Generate the single-frequency grayscale image

    -
    -cutEveryNSpectra()[source]
    +
    +cutEveryNSpectra()[source]

    Cut m spectra every n spectra

    -
    -deNoise()[source]
    +
    +deNoise()[source]

    SVD

    -
    -deNoiseDark()[source]
    +
    +deNoiseDark()[source]

    Denoise Dark with Savitky-Golay

    -
    -deNoiseNRB()[source]
    +
    +deNoiseNRB()[source]

    Denoise NRB with Savitky-Golay

    -
    -deleteOverlays()[source]
    +
    +deleteOverlays()[source]
    -
    -delete_preview_rois()[source]
    +
    +delete_preview_rois()[source]
    -
    -doComposite()[source]
    +
    +doComposite()[source]

    Update color composite image.

    -
    -doKK()[source]
    +
    +doKK()[source]

    Pop-up Kramers-Kronig parameter entry dialog and perform the Kramers-Kronig phase retrieval algorithm.

    -
    -doMath()[source]
    +
    +doMath()[source]

    Perform selected math operation on single-color imagery.

    -
    -doUndo()[source]
    +
    +doUndo()[source]

    Undo last operation back to last backup point

    -
    -errorCorrectAmp()[source]
    +
    +errorCorrectAmp()[source]

    Error Correction: Amp aka Baseline Detrending

    Notes

    If data is complex, amplitude detrending occurs on and only on the imaginary portion

    -
    -errorCorrectPhase()[source]
    +
    +errorCorrectPhase()[source]

    Error Correction: Phase

    -
    -errorCorrectScale()[source]
    +
    +errorCorrectScale()[source]

    Error Correction: Scale

    -
    -fileOpenDLMNIST()[source]
    +
    +fileOpenDLMNIST()[source]

    Open and load DLM File

    -
    -fileOpenHDFNIST(*args, dialog=True)[source]
    +
    +fileOpenHDFMacroRasterNIST(*args, dialog=True)[source]
    +

    Open and load multiple datasets from HDF file that describe a single image. +Used for a macrostage rastering mode at NIST.

    +
    +
    dialogbool

    Present a gui for file and dataset selection

    +
    +
    +
    + +
    +
    +fileOpenHDFNIST(*args, dialog=True)[source]

    Open and load HDF5 File

    dialogbool

    Present a gui for file and dataset selection

    @@ -463,8 +483,8 @@

    Authors -
    -fileOpenHDFNISTOOC(*args)[source]
    +
    +fileOpenHDFNISTOOC(*args)[source]

    Open and load HDF5 File OUT-OF-CORE

    dialogbool

    Present a gui for file and dataset selection

    @@ -473,134 +493,134 @@

    Authors -
    -fileOpenSuccess(success)[source]
    +
    +fileOpenSuccess(success)[source]

    Executed after a file is loaded. Checks success and appropriately activates or deactivates action (buttons)

    -
    -freqWindow()[source]
    +
    +freqWindow()[source]

    Limit the frequency window displayed and analyzed

    -
    -get_preview_spectra(full=False)[source]
    +
    +get_preview_spectra(full=False)[source]

    If self.preview_rois is set, output the mean spectra from thos regions

    -
    -inverseAnscombe()[source]
    +
    +inverseAnscombe()[source]

    Performance an Inverse Anscombe transformation

    -
    -lineEditFreqChanged()[source]
    +
    +lineEditFreqChanged()[source]

    Frequency manually entered in frequency-slider-display

    -
    -lineEditPixChanged()[source]
    +
    +lineEditPixChanged()[source]

    Frequency in pixel units manually entered in frequency-slider-display

    -
    -loadDark()[source]
    +
    +loadDark()[source]

    Open HDF file and load dark spectrum(a)

    -
    -loadDarkDLM()[source]
    +
    +loadDarkDLM()[source]

    Open DLM file and load dark spectrum(a)

    -
    -loadNRB()[source]
    +
    +loadNRB()[source]

    Open HDF file and load NRB spectrum(a)

    -
    -loadNRBDLM()[source]
    +
    +loadNRBDLM()[source]

    Open DLM file and load NRB spectrum(a)

    -
    -makeBCARSPhantom()[source]
    +
    +makeBCARSPhantom()[source]

    Generate a numerical phantom for BCARS

    -
    -makeRamanPhantom()[source]
    +
    +makeRamanPhantom()[source]

    Generate a numerical phantom for Raman

    -
    -mergeNRBs()[source]
    +
    +mergeNRBs()[source]

    Interactive merge of the left- and right-side NRB

    -
    -mosaicTool()[source]
    +
    +mosaicTool()[source]
    -
    -nrbFromROI()[source]
    +
    +nrbFromROI()[source]

    Acquire an average spectrum from a user-selected ROI and apply to the NRB– either as the new NRB or averaged with the existing (sender- dependent)

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    -
    -opChange()[source]
    +
    +opChange()[source]

    Math operation performed on single-color images changed.

    -
    -plotDarkSpectrum()[source]
    +
    +plotDarkSpectrum()[source]

    Plot dark spectrum

    -
    -plotLeftNRBSpectrum()[source]
    +
    +plotLeftNRBSpectrum()[source]

    Plot Left-Side NRB spectrum

    -
    -plotNRBSpectrum()[source]
    +
    +plotNRBSpectrum()[source]

    Plot NRB spectrum

    -
    -plotRightNRBSpectrum()[source]
    +
    +plotRightNRBSpectrum()[source]

    Plot NRB spectrum

    -
    -plotter_show()[source]
    +
    +plotter_show()[source]
    -
    -pointSpectrum()[source]
    +
    +pointSpectrum()[source]

    Get spectrum of selected point.

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    @@ -610,8 +630,8 @@

    Authors -
    -roiSpectrum()[source]
    +
    +roiSpectrum()[source]

    Plot spectrum over selected region-of-interest (ROI).

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    @@ -622,177 +642,177 @@

    Authors -
    -save()[source]
    +
    +save()[source]

    -
    -setCondFreq1()[source]
    +
    +setCondFreq1()[source]

    Set color math conditional frequency #1

    -
    -setCondFreq2()[source]
    +
    +setCondFreq2()[source]

    Set color math conditional frequency #2

    -
    -setCondFreq3()[source]
    +
    +setCondFreq3()[source]

    Set color math conditional frequency #1

    -
    -setOpFreq1()[source]
    +
    +setOpFreq1()[source]

    Set color math frequency #1 (the primary frequency)

    -
    -setOpFreq2()[source]
    +
    +setOpFreq2()[source]

    Set color math frequency #2 (e.g., freq #1 + freq #2)

    -
    -setOpFreq3()[source]
    +
    +setOpFreq3()[source]

    Set color math frequency #3 (e.g., Amplitude at freq #1 - interpolation [freq #2, freq #3])

    -
    -set_preview_rois()[source]
    +
    +set_preview_rois()[source]

    Set the preview ROIs. NOTE: this function just sets the signal for the MPL window

    -
    -settings()[source]
    +
    +settings()[source]

    Go to settings tab

    -
    -showPreviewRois()[source]
    +
    +showPreviewRois()[source]
    -
    -sliderPressed()[source]
    +
    +sliderPressed()[source]

    Respond to press of frequency slider (set tracking of location)

    -
    -sliderReleased()[source]
    +
    +sliderReleased()[source]

    Respond to release of frequency slider (end tracking of location)

    -
    -specialDemosaicRGB()[source]
    +
    +specialDemosaicRGB()[source]
    -
    -specialEstCalibration1()[source]
    +
    +specialEstCalibration1()[source]

    For NIST BCARS 2, maximum raw spectrum occurs at approximately 745.8 nm (18/07/11)

    -
    -spectrumColorImg()[source]
    +
    +spectrumColorImg()[source]

    Generate plot of mean

    -
    -spinBoxInEqualityChange()[source]
    +
    +spinBoxInEqualityChange()[source]

    Conditional inequality value changed.

    -
    -subDark()[source]
    +
    +subDark()[source]

    Subtract loaded dark spectrum from HSI data.

    -
    -subResidual()[source]
    +
    +subResidual()[source]

    Subtract a linear residual over range

    -
    -subtractROIStart()[source]
    +
    +subtractROIStart()[source]

    Acquire an average spectrum from a user-selected ROI and subtract.

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    -
    -tabMainChange()[source]
    +
    +tabMainChange()[source]
    -
    -toolbarSetting()[source]
    +
    +toolbarSetting()[source]

    Set the toolbar ribbon view

    -
    -toolbarSetup()[source]
    +
    +toolbarSetup()[source]

    Setup the tool ribbon icons

    -
    -updateHistory()[source]
    +
    +updateHistory()[source]
    -
    -updateOverlays()[source]
    +
    +updateOverlays()[source]
    -
    -zeroFirstColumn()[source]
    +
    +zeroFirstColumn()[source]

    Zero first non-all-zero column. (Rather than crop)

    -
    -zeroFirstRow()[source]
    +
    +zeroFirstRow()[source]

    Zero first non-all-zero row. (Rather than crop)

    -
    -zeroLastColumn()[source]
    +
    +zeroLastColumn()[source]

    Zero first non-all-zero column. (Rather than crop)

    -
    -zeroLastRow()[source]
    +
    +zeroLastRow()[source]

    Zero first non-all-zero row. (Rather than crop)

    -
    -crikit.CRIkitUI.crikit_launch(**kwargs)[source]
    +
    +crikit.CRIkitUI.crikit_launch(**kwargs)[source]

    Command line launching of CRIkitUI.

    -
    hsicrikit.data.Hsi

    Hsi instance

    +
    hsicrikit.data.spectra.Hsi

    Hsi instance

    datandarray (3D)

    Numpy array (Y,X,Freq) hsi

    @@ -823,28 +843,28 @@

    Authors +

    + + +

    Module contents

    -
    +

    CRIKit2: Hyperspectral imaging toolkit

    CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral imaging (HSI) platform (user interface, UI).

    -
    +

    Usage

    python -m crikit

    -
    -
    +
    +

    Authors

    -
    -
    -
    -
    + + + +
    @@ -853,8 +873,9 @@

    Authors

    utils.general.arange_nonzero(start, stop[, …])

    utils.general.arange_nonzero(start, stop[, ...])

    Similar to numpy arange but only returns non-zero elements

    utils.general.expand_1d_to_ndim(data, ndim)

    Make 1D array into ndim dimensions

    utils.general.expand_1d_to_ndim_data(data, …)

    utils.general.expand_1d_to_ndim_data(data, ...)

    Make 1D data array equal in dimensions to data_to_match

    utils.general.find_nearest(np_vec[, to_find])

    @@ -199,25 +201,27 @@

    C

  • calib (crikit.data.frequency.Frequency attribute)
  • -
  • calib() (crikit.data.frequency.Frequency property) - -
  • calib_data_agree() (crikit.data.replicate.Replicate method), [1]
  • calib_fcn (crikit.data.frequency.Frequency attribute) + +
  • calib_orig (crikit.data.frequency.Frequency attribute) + +
  • calib_pix_wl() (in module crikit.data.frequency)
  • calib_pix_wn() (in module crikit.data.frequency) @@ -264,13 +268,15 @@

    C

  • changeWinSize() (crikit.ui.widget_SG.widgetSG method)
  • -
  • check() (crikit.data.hsi.Hsi method) +
  • check() (crikit.data.spectra.Hsi method)
  • check_for_spatial_calib() (crikit.ui.main_Mosaic.MainWindowMosaic method)
  • check_for_spectral_calib() (crikit.ui.main_Mosaic.MainWindowMosaic method)
  • check_requirements() (in module crikit.ui.utils.check_requirements) +
  • +
  • check_type_compat() (in module crikit.io.lazy5.nonh5utils)
  • checkBoxFixed() (crikit.ui.widget_images.widgetBWImg method)
  • @@ -289,6 +295,8 @@

    C

  • clear_all() (crikit.ui.helper_roiselect.ImageSelection method)
  • clearTerminal() (crikit.ui.widget_Jupyter.QJupyterWidget method) +
  • +
  • close_if_file_not_fid() (crikit.io.lazy5.utils.FidOrFile method)
  • closeEvent() (crikit.CRIkitUI.CRIkitUI_process method) @@ -320,12 +328,14 @@

    C

  • condOpsChange() (crikit.ui.widget_images.widgetImageGainMath method)
  • -
  • config (crikit.data.hsi.Hsi attribute) +
  • config (crikit.data.spectra.Hsi attribute)
  • - -
    • crikit.io.hdf5
    • +
    • + crikit.io.lazy5 + +
    • +
    • + crikit.io.lazy5.alter + +
    • +
    • + crikit.io.lazy5.config + +
    • +
    • + crikit.io.lazy5.create + +
    • +
    • + crikit.io.lazy5.inspect + +
    • +
    • + crikit.io.lazy5.nonh5utils + +
    • +
    • + crikit.io.lazy5.tests + +
    • +
    + @@ -1101,25 +1218,29 @@

    D

  • data (crikit.data.frequency.Frequency attribute)
  • -
  • data() (crikit.data.frequency.Frequency property) - -
  • +
  • dataGroupChange() (crikit.io.lazy5.ui.QtHdfLoad.HdfLoad method) +
  • +
  • datasetSelected() (crikit.io.lazy5.ui.QtHdfLoad.HdfLoad method) +
  • +
  • DefaultConfig (class in crikit.io.lazy5.config) +
  • delete_preview_rois() (crikit.CRIkitUI.CRIkitUI_process method)
  • deleteDataset() (crikit.ui.main_Mosaic.MainWindowMosaic method) @@ -1139,11 +1260,11 @@

    D

  • dialogAnscombeOptions() (crikit.ui.dialog_varstabAnscombeOptions.DialogAnscombeOptions static method)
  • DialogCalcAnscombeParams (class in crikit.ui.dialog_AnscombeParams) -
  • -
  • dialogCalcAnscombeParams() (crikit.ui.dialog_AnscombeParams.DialogCalcAnscombeParams static method)
  • @@ -1198,32 +1319,40 @@

    E

  • errorCorrectScale() (crikit.CRIkitUI.CRIkitUI_process method)
  • - - +

    F

  • FFTSignalMetric (class in crikit.measurement.fftspatialnoise) +
  • +
  • fid (crikit.io.lazy5.utils.FidOrFile attribute) +
  • +
  • FidOrFile (class in crikit.io.lazy5.utils) +
  • +
  • fileOpen() (crikit.io.lazy5.ui.QtHdfLoad.HdfLoad method)
  • Frequency (class in crikit.data.frequency)
  • frequency_calib (crikit.ui.main_Mosaic.MainWindowMosaic attribute)
  • freqWindow() (crikit.CRIkitUI.CRIkitUI_process method)
  • -
  • fullRange() (crikit.ui.widget_mergeNRBs.widgetMergeNRBs property) +
  • fullpath() (in module crikit.io.lazy5.utils) +
  • +
  • fullRange (crikit.ui.widget_mergeNRBs.widgetMergeNRBs property)
  • @@ -1307,16 +1450,24 @@

    G

  • generateDatasetName() (crikit.ui.dialog_save.DialogSave method)
  • generateFilename() (crikit.ui.dialog_save.DialogSave method) +
  • +
  • get_attrs_dset() (in module crikit.io.lazy5.inspect)
  • get_closest_freq() (crikit.data.frequency.Frequency method), [1]
  • -
  • get_index_of_closest_freq() (crikit.data.frequency.Frequency method), [1] +
  • get_datasets() (in module crikit.io.lazy5.inspect)
  • -
  • get_preview_spectra() (crikit.CRIkitUI.CRIkitUI_process method) +
  • get_groups() (in module crikit.io.lazy5.inspect) +
  • +
  • get_hierarchy() (in module crikit.io.lazy5.inspect) +
  • +
  • get_index_of_closest_freq() (crikit.data.frequency.Frequency method), [1]
  • +
  • getFileDataSets() (crikit.io.lazy5.ui.QtHdfLoad.HdfLoad static method) +
  • getFilename() (crikit.ui.dialog_save.DialogSave method)
  • getLineStyle() (crikit.ui.helper_plotOptions.plotStyle method) @@ -1338,7 +1491,7 @@

    G

  • goInteractive() (crikit.ui.dialog_kkOptions.DialogKKOptions method)
  • -
  • grayscaleimage() (crikit.ui.classes_ui.BW property) +
  • grayscaleimage (crikit.ui.classes_ui.BW property)
  • @@ -1348,17 +1501,33 @@

    H

    -
  • hsi_i() (crikit.datasets.model.Model property) +
  • hsi_i (crikit.datasets.model.Model property)
  • -
  • hsi_r() (crikit.datasets.model.Model property) +
  • hsi_r (crikit.datasets.model.Model property)
  • @@ -1377,10 +1546,12 @@

    I

  • inverseAnscombe() (crikit.CRIkitUI.CRIkitUI_process method)
  • -
  • is2d() (crikit.data.mosaic.Mosaic property) +
  • is2d (crikit.data.mosaic.Mosaic property)
  • -
  • is3d() (crikit.data.mosaic.Mosaic property) +
  • is3d (crikit.data.mosaic.Mosaic property)
  • is_duplicate_import() (crikit.ui.main_Mosaic.MainWindowMosaic method)
  • -
  • issamedim() (crikit.data.mosaic.Mosaic property) +
  • is_fid (crikit.io.lazy5.utils.FidOrFile attribute) +
  • +
  • issamedim (crikit.data.mosaic.Mosaic property)
  • @@ -1438,16 +1611,14 @@

    K

    L

    @@ -1930,20 +2135,26 @@

    O

    -
  • maxer() (crikit.ui.classes_ui.BW property) +
  • maxer (crikit.ui.classes_ui.BW property)
  • -
  • mean() (crikit.data.spectrum.Spectrum method) - -
  • mean_nd_to_1d() (in module crikit.utils.general)
  • mean_spatial() (crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization method) @@ -1633,16 +1802,16 @@

    M

  • meta (crikit.data.spectra.Spectra attribute)
  • -
  • meta() (crikit.data.spectrum.Spectrum property) +
  • (crikit.data.spectra.Spectrum property)
  • +
  • meta_process() (in module crikit.io.meta_process)
  • -
  • minner() (crikit.ui.classes_ui.BW property) +
  • minner (crikit.ui.classes_ui.BW property)
  • -
  • mode_txt() (crikit.ui.classes_ui.CompositeColor property) +
  • mode_txt (crikit.ui.classes_ui.CompositeColor property)
  • Model (class in crikit.datasets.model)
  • @@ -1685,16 +1854,12 @@

    M

  • crikit.data.factorized
  • crikit.data.frequency -
  • -
  • crikit.data.hsi
  • crikit.data.mosaic
  • crikit.data.replicate
  • crikit.data.spectra -
  • -
  • crikit.data.spectrum
  • crikit.data.tests
  • @@ -1717,6 +1882,40 @@

    M

  • crikit.io.csv_nist
  • crikit.io.hdf5 +
  • +
  • crikit.io.lazy5 +
  • +
  • crikit.io.lazy5.alter +
  • +
  • crikit.io.lazy5.config +
  • +
  • crikit.io.lazy5.create +
  • +
  • crikit.io.lazy5.inspect +
  • +
  • crikit.io.lazy5.nonh5utils +
  • +
  • crikit.io.lazy5.tests +
  • +
  • crikit.io.lazy5.tests.test_alter +
  • +
  • crikit.io.lazy5.tests.test_create +
  • +
  • crikit.io.lazy5.tests.test_inspect +
  • +
  • crikit.io.lazy5.tests.test_nonh5utils +
  • +
  • crikit.io.lazy5.tests.test_ui +
  • +
  • crikit.io.lazy5.tests.test_utils +
  • +
  • crikit.io.lazy5.ui +
  • +
  • crikit.io.lazy5.ui.qt_HdfLoad +
  • +
  • crikit.io.lazy5.ui.QtHdfLoad +
  • +
  • crikit.io.lazy5.utils
  • crikit.io.macros
  • @@ -1882,14 +2081,20 @@

    N

  • N_EDGE (crikit.ui.dialog_kkOptions.DialogKKOptions attribute)
  • n_pix (crikit.data.spectra.Spectra attribute) + +
  • +
  • ndim (crikit.data.spectra.Spectrum attribute) + +
  • +
  • noise_sigma (crikit.measurement.peakfind.PeakFinder property)
  • -
  • noise_sigma() (crikit.measurement.peakfind.PeakFinder property) +
  • norm_to_nrb (crikit.cri.kk.KramersKronig property)
  • NORM_TO_NRB (crikit.ui.dialog_kkOptions.DialogKKOptions attribute)
  • @@ -1901,8 +2106,6 @@

    N

  • nrbFromROI() (crikit.CRIkitUI.CRIkitUI_process method)
  • -
  • num_selections() (crikit.ui.helper_roiselect.ImageSelection property) +
  • num_selections (crikit.ui.helper_roiselect.ImageSelection property)
  • num_steps (crikit.utils.breadcrumb.BCPre attribute) + +
  • NUMCOLORS (crikit.CRIkitUI.CRIkitUI_process attribute)
  • -
  • pad_factor() (crikit.cri.kk.KramersKronig property) -
  • parameters (crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin attribute)
      @@ -2024,6 +2235,8 @@

      P

  • PeakFinder (class in crikit.measurement.peakfind) +
  • +
  • phase_offset (crikit.cri.kk.KramersKronig property)
  • PHASE_OFFSET (crikit.ui.dialog_kkOptions.DialogKKOptions attribute)
  • @@ -2033,28 +2246,32 @@

    P

  • (crikit.ui.widget_KK.widgetKK attribute)
  • -
  • phase_offset() (crikit.cri.kk.KramersKronig property) -
  • PhaseErrCorrectALS (class in crikit.cri.error_correction)
  • pix_vec (crikit.data.frequency.Frequency attribute) + +
  • @@ -2093,7 +2316,7 @@

    P

    Q

    - +
    +
  • test_attr_alter() (in module crikit.io.lazy5.tests.test_alter) +
  • +
  • test_attr_alter_same() (in module crikit.io.lazy5.tests.test_alter) +
  • test_basic() (in module crikit.cri.tests.test_merge_nrbs)
  • +
  • test_fullpath() (in module crikit.io.lazy5.tests.test_utils) +
  • +
  • test_get_datasets_fullpath() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_datasets_nopath() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_dset_attrs() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_groups() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_hierarchy_fullpath() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_hierarchy_grp_w_dset() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_get_hierarchy_nopath() (in module crikit.io.lazy5.tests.test_inspect) +
  • test_hdf2() (in module crikit.data.tests.test_mosaic_hdf)
  • test_hdf_import_hsi_to_hsi() (in module crikit.io.tests.test_hdf5) @@ -2438,6 +2697,8 @@

    T

  • test_hdf_import_spectra_to_spectra() (in module crikit.io.tests.test_hdf5)
  • test_hdf_import_spectrum_to_spectrum() (in module crikit.io.tests.test_hdf5) +
  • +
  • test_hdf_is_open() (in module crikit.io.lazy5.tests.test_utils)
  • test_hilbert_in_place() (in module crikit.cri.tests.test_hilbert)
  • @@ -2587,6 +2848,8 @@

    T

  • (in module crikit.data.tests.test_spectra)
  • +
  • test_return_family_type() (in module crikit.io.lazy5.tests.test_nonh5utils) +
  • test_rng() (in module crikit.cri.tests.test_pec)
      @@ -2606,6 +2869,14 @@

      T

  • test_rng_redux_fix_rng_vecasym() (in module crikit.preprocess.tests.test_als) +
  • +
  • test_save_diff_path() (in module crikit.io.lazy5.tests.test_create) +
  • +
  • test_save_no_attrs() (in module crikit.io.lazy5.tests.test_create) +
  • +
  • test_save_to_open_h5_file() (in module crikit.io.lazy5.tests.test_create) +
  • +
  • test_save_to_open_wrong_type() (in module crikit.io.lazy5.tests.test_create)
  • test_spectra_to_hsi() (in module crikit.data.tests.test_hsi)
  • @@ -2676,6 +2947,24 @@

    T

  • test_transform_incompatible_dtypes() (in module crikit.preprocess.tests.test_subtract_dark)
  • test_transform_rng() (in module crikit.cri.tests.test_pec) +
  • +
  • test_ui_attrs() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_change_grp_and_filter_exclude() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_change_grp_and_filter_include() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_load_file() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_win_title_empty_load_dataset() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_win_title_load_dataset() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_ui_wrongfile() (crikit.io.lazy5.tests.test_ui.TestUI method) +
  • +
  • test_valid_dsets() (in module crikit.io.lazy5.tests.test_inspect) +
  • +
  • test_valid_file() (in module crikit.io.lazy5.tests.test_inspect)
  • test_vec_asym_param() (in module crikit.preprocess.tests.test_als) @@ -2689,6 +2978,8 @@

    T

  • (in module crikit.preprocess.tests.test_baseline_sub)
  • +
  • test_write_attr_dict() (in module crikit.io.lazy5.tests.test_alter) +
  • test_zero_col_first_col() (in module crikit.preprocess.tests.test_crop)
  • test_zero_col_last_col() (in module crikit.preprocess.tests.test_crop) @@ -2696,6 +2987,8 @@

    T

  • test_zero_row_first_row() (in module crikit.preprocess.tests.test_crop)
  • test_zero_row_last_row() (in module crikit.preprocess.tests.test_crop) +
  • +
  • TestUI (class in crikit.io.lazy5.tests.test_ui)
  • textFromValue() (crikit.ui.widget_scientificspin.ScientificDoubleSpinBox method)
  • @@ -2736,30 +3029,30 @@

    U

    • ui_changes() (crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization method) +
    • +
    • Ui_Dialog (class in crikit.io.lazy5.ui.qt_HdfLoad)
    • units (crikit.data.frequency.Frequency attribute)
    • -
    • units() (crikit.data.frequency.Frequency property) - -
    • -
    • unitshape() (crikit.data.mosaic.Mosaic property) +
    • unitshape (crikit.data.mosaic.Mosaic property)
    • -
    • unitshape_orig() (crikit.data.mosaic.Mosaic property) +
    • unitshape_orig (crikit.data.mosaic.Mosaic property)
    • -
    • unselected_factors() (crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization property) +
    • unselected_factors (crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization property)
    • update() (crikit.data.frequency.Frequency method), [1]
    • @@ -2797,6 +3090,10 @@

      U

      V

      - +
      @@ -2873,7 +3172,7 @@

      W

      X

        -
      • x_rep() (crikit.data.hsi.Hsi property) +
      • x_rep (crikit.data.spectra.Hsi property)
      • -
      • xlen() (crikit.ui.classes_ui.BW property) +
      • xlen (crikit.ui.classes_ui.BW property)
        • (crikit.ui.classes_ui.CompositeColor property) @@ -2897,7 +3196,7 @@

          X

          Y

          - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          @@ -46,7 +45,7 @@

          Navigation

          PyPI - Python Version PyPI Project Page NIST Public Domain -
          +

          CRIKit2: Hyperspectral imaging toolkit

          CRIkit2 Logo

          CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral @@ -54,7 +53,7 @@

          CRIKit2: Hyperspectral imaging toolkit -

          User Documentation

          +

          User Documentation

          +

          Indices and tables

          -
          +

          Dependencies

          Note: These are the developmental system specs. Older versions of certain packages may work.

          @@ -123,8 +122,7 @@

          Dependencies +

          IMPORTANT: For Python 3.4

          You will need to manually install PyQt5 and Qt5 or get it through a distribution:

          -

          -
          +
          +

          For Python 3.5, installation through pip available

          pip3 install pyqt5
           
          -
          - -
          + + +

          Known Issues

          -
          +

          Windows 10 with High-Resolution Monitors

          The GUI may appear squashed with small font. There is a work-around described at https://github.com/CCampJr/CRIkit2/issues/79

          -
          -
          +
          +

          PyQt 5.7.*

          There is a bug in PyQt 5.7.* that will prevent SciPlot’s tables from showing the individual plot entries (see https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038483.html). Apparently, this will be fixed in 5.7.2.

          @@ -166,11 +164,11 @@

          PyQt 5.7.* +

          + +

          Installation

          -
          +

          Option 1: Easily updatable through git (dynamic copy)

          # Make new directory for crikit2 and enter it
           # Clone from github
          @@ -183,8 +181,8 @@ 

          Option 1: Easily updatable through git (dynamic copy)git pull

          -
          -
          +
          +

          Option 2: Static Copy

          # Make new directory for crikit2 and enter it
           # Clone from github
          @@ -198,8 +196,8 @@ 

          Option 2: Static Copy# You can now delete the source files you downloaded

          -
          -
          + +

          (Re-) Building Documentation

          The documentation was built using Sphinx. A pre-built version of the html files is included with this module, but you may wish to rebuild on your own @@ -216,9 +214,9 @@

          (Re-) Building Documentationmake.bat html

          - - -
          + + +

          Starting the CRIkit2 UI

          python3 -m crikit
           
          @@ -227,8 +225,8 @@ 

          Starting the CRIkit2 UIpython -m crikit

          -
          -
          + +

          Known Operational Nuances

          • The SVD visualization tool uses a complex-valued SVD for complex values; thus, there are a few @@ -243,8 +241,8 @@

            Known Operational Nuances +

          +

          LICENSE

          This software was developed by employees of the National Institute of Standards and Technology (NIST), an agency of the Federal Government. Pursuant to @@ -265,18 +263,18 @@

          LICENSE +

          +

          CITATION

          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 47, 408-416 (2016).

          -
          -
          + +

          Contact

          Charles H Camp Jr: charles.camp@nist.gov

          -
          - + +
          @@ -285,8 +283,9 @@

          Contact
          -

          Table of Contents

          -
          @@ -54,9 +53,9 @@

          Navigation



          -
          +

          Installation Information

          -
          +

          Dependencies

          Note: These are the developmental system specs. Older versions of certain packages may work.

          @@ -71,8 +70,7 @@

          Dependencies +

          IMPORTANT: For Python 3.4

          You will need to manually install PyQt5 and Qt5 or get it through a distribution:

          -

          -
          +
          +

          For Python 3.5, installation through pip available

          pip3 install pyqt5
           
          -
          - -
          + + +

          Known Issues

          -
          +

          Windows 10 with High-Resolution Monitors

          The GUI may appear squashed with small font. There is a work-around

          described at https://github.com/CCampJr/CRIkit2/issues/79

          -
          -
          +
          +

          PyQt 5.7.*

          There is a bug in PyQt 5.7.* that will prevent SciPlot’s tables from showing the individual plot entries (see https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038483.html). Apparently, this will be fixed in 5.7.2.

          @@ -117,9 +115,9 @@

          PyQt 5.7.* +

          + +

          Installation

          It is advisable to clone CRIkit2 via git (https://git-scm.com/) and install in a developmental mode via pip or conda as this will enable you to @@ -129,7 +127,7 @@

          Installation +

          Option 1: Dynamic, Updatable Clone of CRIkit2

          # Note: in Windows, commands will be followed by .exe
           # Note: On multi-python systems, you should probably append a 3 to end
          @@ -146,8 +144,8 @@ 

          Option 1: Dynamic, Updatable Clone of CRIkit2git pull

          -

          -
          + +

          Option 2: Static Copy

          The static copy will copy the CRIkit2 install into your Python distribution and will not be updatable without re-installing CRIkit2

          @@ -169,14 +167,14 @@

          Option 2: Static Copypip install .

          - - -
          + +

          (Re-) Building Documentation

          A pre-built version of the documentation is included with the installation; thus, this step should not be necessary unless you are making modifications @@ -196,9 +194,9 @@

          (Re-) Building Documentationmake html # On Windows make.bat html

          - - - + + +
          @@ -207,8 +205,9 @@

          (Re-) Building Documentation
          -

          Table of Contents

          -
          @@ -54,9 +53,9 @@

          Navigation



          -
          +

          Input/Output (IO) Interfaces for CRIkit2

          -
          +
          @@ -65,12 +64,16 @@

          Input/Output (IO) Interfaces for CRIkit2
          -

          Previous topic

          -

          Command Line Tools & Algorithms

          -

          Next topic

          -

          License

          +
          +

          Previous topic

          +

          Command Line Tools & Algorithms

          +
          +
          +

          Next topic

          +

          License

          +

          This Page

          \ No newline at end of file diff --git a/docs/build/html/license.html b/docs/build/html/license.html index 46b63ea..b8ed2ae 100644 --- a/docs/build/html/license.html +++ b/docs/build/html/license.html @@ -4,16 +4,15 @@ - - License — CRIKit2 0.4.1 documentation - - - + + + License — CRIKit2 0.4.3 documentation + + + - - @@ -34,7 +33,7 @@

          Navigation

        • previous |
        • - +
          @@ -54,7 +53,7 @@

          Navigation



          -
          +

          License

          This software was developed at the National Institute of Standards and Technology (NIST) by employees of the Federal Government in the course of their official duties. Pursuant to @@ -67,7 +66,7 @@

          License

          @@ -76,12 +75,16 @@

          License
          -

          Previous topic

          -

          Input/Output (IO) Interfaces for CRIkit2

          -

          Next topic

          -

          API Reference

          + +
          +

          Next topic

          +

          API Reference

          +

          This Page

          \ No newline at end of file diff --git a/docs/build/html/modules.html b/docs/build/html/modules.html index 581bb7c..7c83555 100644 --- a/docs/build/html/modules.html +++ b/docs/build/html/modules.html @@ -4,16 +4,15 @@ - - CRIkit2 — CRIKit2 0.4.1 documentation - - - + + + CRIkit2 — CRIKit2 0.4.3 documentation + + + - - @@ -26,7 +25,7 @@

          Navigation

        • modules |
        • - +
          @@ -36,7 +35,7 @@

          Navigation

          - \ No newline at end of file diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv index ee7deb3..359e98c 100644 Binary files a/docs/build/html/objects.inv and b/docs/build/html/objects.inv differ diff --git a/docs/build/html/py-modindex.html b/docs/build/html/py-modindex.html index 5072425..151d946 100644 --- a/docs/build/html/py-modindex.html +++ b/docs/build/html/py-modindex.html @@ -5,15 +5,13 @@ - Python Module Index — CRIKit2 0.4.1 documentation - - - + Python Module Index — CRIKit2 0.4.3 documentation + + + - - @@ -29,7 +27,7 @@

          Navigation

        • modules |
        • - +
          @@ -141,11 +139,6 @@

          Python Module Index

              crikit.data.frequency
              - crikit.data.hsi -
              @@ -161,11 +154,6 @@

          Python Module Index

              crikit.data.spectra
              - crikit.data.spectrum -
              @@ -221,6 +209,91 @@

          Python Module Index

              crikit.io.hdf5
              + crikit.io.lazy5 +
              + crikit.io.lazy5.alter +
              + crikit.io.lazy5.config +
              + crikit.io.lazy5.create +
              + crikit.io.lazy5.inspect +
              + crikit.io.lazy5.nonh5utils +
              + crikit.io.lazy5.tests +
              + crikit.io.lazy5.tests.test_alter +
              + crikit.io.lazy5.tests.test_create +
              + crikit.io.lazy5.tests.test_inspect +
              + crikit.io.lazy5.tests.test_nonh5utils +
              + crikit.io.lazy5.tests.test_ui +
              + crikit.io.lazy5.tests.test_utils +
              + crikit.io.lazy5.ui +
              + crikit.io.lazy5.ui.qt_HdfLoad +
              + crikit.io.lazy5.ui.QtHdfLoad +
              + crikit.io.lazy5.utils +
              @@ -584,7 +657,7 @@

          Python Module Index

          Quick search

          @@ -603,13 +676,13 @@

          Navigation

        • modules |
        • - + \ No newline at end of file diff --git a/docs/build/html/running.html b/docs/build/html/running.html index ba8e567..983e18d 100644 --- a/docs/build/html/running.html +++ b/docs/build/html/running.html @@ -4,16 +4,15 @@ - - Running the CRIkit2 Graphical User Interface — CRIKit2 0.4.1 documentation - - - + + + Running the CRIkit2 Graphical User Interface — CRIKit2 0.4.3 documentation + + + - - @@ -34,7 +33,7 @@

          Navigation

        • previous |
        • - + @@ -54,9 +53,9 @@

          Navigation



          -
          +

          Running the CRIkit2 Graphical User Interface

          -
          +

          As a module

          python3 -m crikit
           
          @@ -65,8 +64,8 @@ 

          As a modulepython -m crikit

          -
          -
          +
          +

          From within a Python/IPython/Jupyter shell

          from crikit.CRIkitUI import crikit_launch
           crikit_launch()
          @@ -88,8 +87,8 @@ 

          From within a Python/IPython/Jupyter shellf_label='Frequency')

          -
          - + +
          @@ -98,8 +97,9 @@

          From within a Python/IPython/Jupyter shell
          -

          Table of Contents

          -
          @@ -42,26 +41,35 @@

          Navigation

          Search

          -
          - + + + +

          Searching for multiple words only shows matches that contain all words.

          + +
          - +
          + +
          +
          @@ -82,13 +90,13 @@

          Navigation

        • modules |
        • - +
          \ No newline at end of file diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index 7e9e037..c6e4595 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["algorithms","api","cri_walkthru","crikit","crikit.cri","crikit.cri.algorithms","crikit.cri.tests","crikit.data","crikit.data.tests","crikit.datasets","crikit.io","crikit.io.tests","crikit.measurement","crikit.measurement.tests","crikit.preprocess","crikit.preprocess.algorithms","crikit.preprocess.tests","crikit.transform","crikit.ui","crikit.ui.utils","crikit.utils","crikit.utils.tests","index","installing","io","license","modules","running"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["algorithms.rst","api.rst","cri_walkthru.rst","crikit.rst","crikit.cri.rst","crikit.cri.algorithms.rst","crikit.cri.tests.rst","crikit.data.rst","crikit.data.tests.rst","crikit.datasets.rst","crikit.io.rst","crikit.io.tests.rst","crikit.measurement.rst","crikit.measurement.tests.rst","crikit.preprocess.rst","crikit.preprocess.algorithms.rst","crikit.preprocess.tests.rst","crikit.transform.rst","crikit.ui.rst","crikit.ui.utils.rst","crikit.utils.rst","crikit.utils.tests.rst","index.rst","installing.rst","io.rst","license.rst","modules.rst","running.rst"],objects:{"":{crikit:[3,0,0,"-"]},"crikit.CRIkitUI":{CRIkitUI_process:[3,1,1,""],crikit_launch:[3,4,1,""]},"crikit.CRIkitUI.CRIkitUI_process":{NUMCOLORS:[3,2,1,""],anscombe:[3,3,1,""],calcAnscombeParams:[3,3,1,""],calibrate:[3,3,1,""],calibrationReset:[3,3,1,""],changeSlider:[3,3,1,""],checkCompositeUpdate:[3,3,1,""],checkShowOverlays:[3,3,1,""],closeEvent:[3,3,1,""],condInEqualityChange:[3,3,1,""],condOpChange:[3,3,1,""],createImgBW:[3,3,1,""],cutEveryNSpectra:[3,3,1,""],deNoise:[3,3,1,""],deNoiseDark:[3,3,1,""],deNoiseNRB:[3,3,1,""],deleteOverlays:[3,3,1,""],delete_preview_rois:[3,3,1,""],doComposite:[3,3,1,""],doKK:[3,3,1,""],doMath:[3,3,1,""],doUndo:[3,3,1,""],errorCorrectAmp:[3,3,1,""],errorCorrectPhase:[3,3,1,""],errorCorrectScale:[3,3,1,""],fileOpenDLMNIST:[3,3,1,""],fileOpenHDFNIST:[3,3,1,""],fileOpenHDFNISTOOC:[3,3,1,""],fileOpenSuccess:[3,3,1,""],freqWindow:[3,3,1,""],get_preview_spectra:[3,3,1,""],inverseAnscombe:[3,3,1,""],lineEditFreqChanged:[3,3,1,""],lineEditPixChanged:[3,3,1,""],loadDark:[3,3,1,""],loadDarkDLM:[3,3,1,""],loadNRB:[3,3,1,""],loadNRBDLM:[3,3,1,""],makeBCARSPhantom:[3,3,1,""],makeRamanPhantom:[3,3,1,""],mergeNRBs:[3,3,1,""],mosaicTool:[3,3,1,""],nrbFromROI:[3,3,1,""],opChange:[3,3,1,""],plotDarkSpectrum:[3,3,1,""],plotLeftNRBSpectrum:[3,3,1,""],plotNRBSpectrum:[3,3,1,""],plotRightNRBSpectrum:[3,3,1,""],plotter_show:[3,3,1,""],pointSpectrum:[3,3,1,""],roiSpectrum:[3,3,1,""],save:[3,3,1,""],setCondFreq1:[3,3,1,""],setCondFreq2:[3,3,1,""],setCondFreq3:[3,3,1,""],setOpFreq1:[3,3,1,""],setOpFreq2:[3,3,1,""],setOpFreq3:[3,3,1,""],set_preview_rois:[3,3,1,""],settings:[3,3,1,""],showPreviewRois:[3,3,1,""],sliderPressed:[3,3,1,""],sliderReleased:[3,3,1,""],specialDemosaicRGB:[3,3,1,""],specialEstCalibration1:[3,3,1,""],spectrumColorImg:[3,3,1,""],spinBoxInEqualityChange:[3,3,1,""],subDark:[3,3,1,""],subResidual:[3,3,1,""],subtractROIStart:[3,3,1,""],tabMainChange:[3,3,1,""],toolbarSetting:[3,3,1,""],toolbarSetup:[3,3,1,""],updateHistory:[3,3,1,""],updateOverlays:[3,3,1,""],zeroFirstColumn:[3,3,1,""],zeroFirstRow:[3,3,1,""],zeroLastColumn:[3,3,1,""],zeroLastRow:[3,3,1,""]},"crikit.cri":{algorithms:[5,0,0,"-"],error_correction:[4,0,0,"-"],kk:[4,0,0,"-"],merge_nrbs:[4,0,0,"-"],tests:[6,0,0,"-"]},"crikit.cri.algorithms":{kk:[5,0,0,"-"]},"crikit.cri.algorithms.kk":{hilbertfft:[5,4,1,""],kkrelation:[5,4,1,""]},"crikit.cri.error_correction":{PhaseErrCorrectALS:[4,1,1,""],ScaleErrCorrectSG:[4,1,1,""]},"crikit.cri.error_correction.PhaseErrCorrectALS":{calculate:[4,3,1,""],transform:[4,3,1,""]},"crikit.cri.error_correction.ScaleErrCorrectSG":{calculate:[4,3,1,""],transform:[4,3,1,""]},"crikit.cri.kk":{KramersKronig:[4,1,1,""]},"crikit.cri.kk.KramersKronig":{calculate:[4,3,1,""],norm_to_nrb:[4,3,1,""],pad_factor:[4,3,1,""],phase_offset:[4,3,1,""]},"crikit.cri.merge_nrbs":{MergeNRBs:[4,1,1,""]},"crikit.cri.merge_nrbs.MergeNRBs":{calculate:[4,3,1,""]},"crikit.cri.tests":{test_hilbert:[6,0,0,"-"],test_kk:[6,0,0,"-"],test_kk_alg:[6,0,0,"-"],test_merge_nrbs:[6,0,0,"-"],test_pec:[6,0,0,"-"],test_sec:[6,0,0,"-"]},"crikit.cri.tests.test_hilbert":{test_hilbert_in_place:[6,4,1,""],test_hilbert_no_pad:[6,4,1,""],test_hilbert_pad:[6,4,1,""],test_hilbert_replace_min_value:[6,4,1,""]},"crikit.cri.tests.test_kk":{test_kk:[6,4,1,""],test_kk_no_bg_norm:[6,4,1,""],test_kk_properties_read:[6,4,1,""],test_kk_properties_setter:[6,4,1,""],test_kk_rng:[6,4,1,""],test_kk_transform:[6,4,1,""],test_kk_transform_fail:[6,4,1,""]},"crikit.cri.tests.test_kk_alg":{test_kk:[6,4,1,""],test_kk_3d:[6,4,1,""],test_kk_conjugate:[6,4,1,""],test_kk_no_bg_norm:[6,4,1,""]},"crikit.cri.tests.test_merge_nrbs":{test_basic:[6,4,1,""]},"crikit.cri.tests.test_pec":{test_basic2D:[6,4,1,""],test_basic3D:[6,4,1,""],test_basic:[6,4,1,""],test_fix_ends:[6,4,1,""],test_fix_rng:[6,4,1,""],test_rng:[6,4,1,""],test_rng_redux2D:[6,4,1,""],test_rng_redux3D:[6,4,1,""],test_rng_redux:[6,4,1,""],test_transform_rng:[6,4,1,""]},"crikit.cri.tests.test_sec":{test_basic:[6,4,1,""],test_basic_transform:[6,4,1,""],test_rng:[6,4,1,""]},"crikit.data":{factorized:[7,0,0,"-"],frequency:[7,0,0,"-"],hsi:[7,0,0,"-"],mosaic:[7,0,0,"-"],replicate:[7,0,0,"-"],spectra:[7,0,0,"-"],spectrum:[7,0,0,"-"],tests:[8,0,0,"-"]},"crikit.data.factorized":{FactorizedHsi:[7,1,1,""],FactorizedSpectra:[7,1,1,""]},"crikit.data.frequency":{Frequency:[7,1,1,""],calib_pix_wl:[7,4,1,""],calib_pix_wn:[7,4,1,""]},"crikit.data.frequency.Frequency":{calib:[7,3,1,"id0"],calib_fcn:[7,3,1,"id1"],calib_orig:[7,3,1,"id2"],data:[7,3,1,"id3"],get_closest_freq:[7,3,1,"id4"],get_index_of_closest_freq:[7,3,1,"id5"],op_list_freq:[7,3,1,"id6"],op_list_pix:[7,3,1,"id7"],op_range_freq:[7,3,1,"id8"],op_range_pix:[7,3,1,""],op_size:[7,3,1,""],pix_vec:[7,3,1,"id9"],plot_list_freq:[7,3,1,"id10"],plot_list_pix:[7,3,1,"id11"],plot_range_freq:[7,2,1,""],size:[7,3,1,"id12"],units:[7,3,1,"id13"],update:[7,3,1,"id14"]},"crikit.data.hsi":{Hsi:[7,1,1,""]},"crikit.data.hsi.Hsi":{check:[7,3,1,""],config:[7,2,1,""],data:[7,3,1,""],get_rand_spectra:[7,3,1,""],mask:[7,3,1,""],shape:[7,2,1,""],size:[7,2,1,""],subtract:[7,3,1,""],x:[7,3,1,""],x_rep:[7,3,1,""],y:[7,3,1,""],y_rep:[7,3,1,""]},"crikit.data.mosaic":{Mosaic:[7,1,1,""]},"crikit.data.mosaic.Mosaic":{append:[7,3,1,""],attr_dict:[7,3,1,""],dtype:[7,3,1,""],is2d:[7,3,1,""],is3d:[7,3,1,""],issamedim:[7,3,1,""],mosaic2d:[7,3,1,""],mosaic_mask:[7,3,1,""],mosaic_shape:[7,3,1,""],mosaicfull:[7,3,1,""],shape:[7,3,1,""],size:[7,3,1,""],unitshape:[7,3,1,""],unitshape_orig:[7,3,1,""]},"crikit.data.replicate":{Replicate:[7,1,1,""]},"crikit.data.replicate.Replicate":{calib:[7,3,1,"id15"],calib_data_agree:[7,3,1,"id16"],data:[7,3,1,"id17"],label:[7,3,1,""],size:[7,3,1,"id18"],units:[7,3,1,"id19"],update_calib_from_data:[7,3,1,"id20"],update_data_from_calib:[7,3,1,"id21"]},"crikit.data.spectra":{Spectra:[7,1,1,""]},"crikit.data.spectra.Spectra":{config:[7,2,1,""],data:[7,3,1,"id22"],freq:[7,2,1,""],label:[7,2,1,""],meta:[7,2,1,""],n_pix:[7,3,1,"id23"],reps:[7,3,1,"id24"],shape:[7,2,1,""],subtract:[7,3,1,""],units:[7,2,1,""]},"crikit.data.spectrum":{Spectrum:[7,1,1,""]},"crikit.data.spectrum.Spectrum":{config:[7,2,1,""],data:[7,3,1,"id25"],f:[7,3,1,""],f_full:[7,3,1,""],f_pix:[7,3,1,"id26"],freq:[7,3,1,"id27"],label:[7,3,1,"id28"],mean:[7,3,1,""],meta:[7,3,1,"id29"],ndim:[7,3,1,"id30"],shape:[7,3,1,"id31"],size:[7,3,1,"id32"],std:[7,3,1,""],subtract:[7,3,1,""],units:[7,3,1,"id33"]},"crikit.data.tests":{test_hsi:[8,0,0,"-"],test_mosaic:[8,0,0,"-"],test_mosaic_hdf:[8,0,0,"-"],test_spectra:[8,0,0,"-"],test_spectrum:[8,0,0,"-"]},"crikit.data.tests.test_hsi":{make_datasets:[8,4,1,""],test_hsi_to_hsi:[8,4,1,""],test_hsi_to_hsi_rng:[8,4,1,""],test_mean_axes_static:[8,4,1,""],test_reshape_axes_static:[8,4,1,""],test_spectra_to_hsi:[8,4,1,""],test_spectra_to_hsi_rng:[8,4,1,""],test_spectrum_to_hsi:[8,4,1,""],test_spectrum_to_hsi_rng:[8,4,1,""]},"crikit.data.tests.test_mosaic":{test_2D_uniform_obj:[8,4,1,""],test_3D_crop_transpose_flips:[8,4,1,""],test_3D_crop_transpose_flips_2:[8,4,1,""],test_3D_uniform_obj:[8,4,1,""],test_big_to_small_2d:[8,4,1,""],test_big_to_small_2d_2:[8,4,1,""],test_big_to_small_3d:[8,4,1,""],test_big_to_small_3d_2:[8,4,1,""],test_big_to_small_3d_output_given:[8,4,1,""],test_blank:[8,4,1,""],test_crop_2D:[8,4,1,""],test_crop_3D:[8,4,1,""],test_err_wrong_dim:[8,4,1,""],test_err_wrong_dim_append:[8,4,1,""]},"crikit.data.tests.test_mosaic_hdf":{hdf_dataset2:[8,4,1,""],test_big_to_small_3d_output_given:[8,4,1,""],test_big_to_small_3d_output_given_crop:[8,4,1,""],test_big_to_small_3d_output_given_crop_transpose_flips:[8,4,1,""],test_hdf2:[8,4,1,""]},"crikit.data.tests.test_spectra":{make_datasets:[8,4,1,""],test_hsi_to_spectra:[8,4,1,""],test_hsi_to_spectra_rng:[8,4,1,""],test_mean_axes_static:[8,4,1,""],test_reshape_axes_static:[8,4,1,""],test_spectra_to_spectra:[8,4,1,""],test_spectra_to_spectra_rng:[8,4,1,""],test_spectrum_to_spectra:[8,4,1,""],test_spectrum_to_spectra_rng:[8,4,1,""]},"crikit.data.tests.test_spectrum":{make_datasets:[8,4,1,""],test_hsi_to_spectrum:[8,4,1,""],test_hsi_to_spectrum_rng:[8,4,1,""],test_mean_axes_static:[8,4,1,""],test_spectra_to_spectrum:[8,4,1,""],test_spectra_to_spectrum_rng:[8,4,1,""],test_spectrum_to_spectrum:[8,4,1,""],test_spectrum_to_spectrum_rng:[8,4,1,""]},"crikit.datasets":{model:[9,0,0,"-"]},"crikit.datasets.model":{Model:[9,1,1,""]},"crikit.datasets.model.Model":{f:[9,3,1,""],hsi_i:[9,3,1,""],hsi_r:[9,3,1,""],make_hsi:[9,3,1,""],make_spectra:[9,3,1,""],wn:[9,3,1,""]},"crikit.io":{csv_nist:[10,0,0,"-"],hdf5:[10,0,0,"-"],macros:[10,0,0,"-"],meta_configs:[10,0,0,"-"],meta_process:[10,0,0,"-"],tests:[11,0,0,"-"]},"crikit.io.csv_nist":{csv_nist_import_data:[10,4,1,""]},"crikit.io.hdf5":{hdf_import_data:[10,4,1,""]},"crikit.io.macros":{import_csv_nist_special1:[10,4,1,""],import_hdf_nist_special:[10,4,1,""]},"crikit.io.meta_configs":{special_nist_bcars1_sample_scan:[10,4,1,""],special_nist_bcars2:[10,4,1,""]},"crikit.io.meta_process":{meta_process:[10,4,1,""],rosetta_query:[10,4,1,""]},"crikit.io.tests":{test_hdf5:[11,0,0,"-"]},"crikit.io.tests.test_hdf5":{hdf_dataset:[11,4,1,""],test_hdf_import_hsi_to_hsi:[11,4,1,""],test_hdf_import_no_output_cls_given:[11,4,1,""],test_hdf_import_spectra_to_spectra:[11,4,1,""],test_hdf_import_spectrum_to_spectrum:[11,4,1,""]},"crikit.measurement":{fftspatialnoise:[12,0,0,"-"],peakamps:[12,0,0,"-"],peakfind:[12,0,0,"-"],tests:[13,0,0,"-"]},"crikit.measurement.fftspatialnoise":{FFTSignalMetric:[12,1,1,""]},"crikit.measurement.fftspatialnoise.FFTSignalMetric":{calc:[12,3,1,""]},"crikit.measurement.peakamps":{AbstractMeasureThree:[12,1,1,""],AbstractMeasureTwo:[12,1,1,""],AbstractMeasureTwoOrdered:[12,1,1,""],MeasurePeak:[12,1,1,""],MeasurePeakAdd:[12,1,1,""],MeasurePeakBWTroughs:[12,1,1,""],MeasurePeakDivide:[12,1,1,""],MeasurePeakMax:[12,1,1,""],MeasurePeakMaxAbs:[12,1,1,""],MeasurePeakMin:[12,1,1,""],MeasurePeakMinAbs:[12,1,1,""],MeasurePeakMinus:[12,1,1,""],MeasurePeakMultiply:[12,1,1,""],MeasurePeakSum:[12,1,1,""],MeasurePeakSumAbsReImag:[12,1,1,""]},"crikit.measurement.peakamps.AbstractMeasureThree":{calculate:[12,3,1,""],measure:[12,3,1,""]},"crikit.measurement.peakamps.AbstractMeasureTwo":{calculate:[12,3,1,""],measure:[12,3,1,""]},"crikit.measurement.peakamps.MeasurePeak":{calculate:[12,3,1,""],measure:[12,3,1,""],output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakAdd":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakBWTroughs":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakDivide":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMax":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMaxAbs":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMin":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMinAbs":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMinus":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakMultiply":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakSum":{output:[12,2,1,""]},"crikit.measurement.peakamps.MeasurePeakSumAbsReImag":{output:[12,2,1,""]},"crikit.measurement.peakfind":{PeakFinder:[12,1,1,""]},"crikit.measurement.peakfind.PeakFinder":{amp:[12,2,1,""],calculate:[12,3,1,""],cwt_diff:[12,3,1,""],cwt_width:[12,3,1,""],haar:[12,3,1,""],noise_sigma:[12,3,1,""]},"crikit.measurement.tests":{test_measurement:[13,0,0,"-"],test_measurements_complex:[13,0,0,"-"],test_peakfind:[13,0,0,"-"]},"crikit.measurement.tests.test_measurement":{hsi_dataset:[13,4,1,""],test_add:[13,4,1,""],test_divide:[13,4,1,""],test_max:[13,4,1,""],test_max_unordered:[13,4,1,""],test_maxabs:[13,4,1,""],test_min:[13,4,1,""],test_min_unordered:[13,4,1,""],test_minabs:[13,4,1,""],test_multiply:[13,4,1,""],test_pbt:[13,4,1,""],test_peak:[13,4,1,""],test_subtract:[13,4,1,""],test_sum:[13,4,1,""],test_sum_re_im:[13,4,1,""],test_sum_unordered:[13,4,1,""]},"crikit.measurement.tests.test_measurements_complex":{hsi_dataset:[13,4,1,""],test_add:[13,4,1,""],test_divide:[13,4,1,""],test_max:[13,4,1,""],test_max_unordered:[13,4,1,""],test_maxabs:[13,4,1,""],test_min:[13,4,1,""],test_min_unordered:[13,4,1,""],test_minabs:[13,4,1,""],test_multiply:[13,4,1,""],test_pbt:[13,4,1,""],test_peak:[13,4,1,""],test_subtract:[13,4,1,""],test_sum:[13,4,1,""],test_sum_abs_re_im:[13,4,1,""],test_sum_unordered:[13,4,1,""]},"crikit.measurement.tests.test_peakfind":{test_peakfind:[13,4,1,""]},"crikit.preprocess":{algorithms:[15,0,0,"-"],crop:[14,0,0,"-"],denoise:[14,0,0,"-"],standardize:[14,0,0,"-"],subtract_baseline:[14,0,0,"-"],subtract_dark:[14,0,0,"-"],subtract_mean:[14,0,0,"-"],tests:[16,0,0,"-"]},"crikit.preprocess.algorithms":{abstract_als:[15,0,0,"-"],als:[15,0,0,"-"],anscombe:[15,0,0,"-"],arpls:[15,0,0,"-"]},"crikit.preprocess.algorithms.abstract_als":{AbstractBaseline:[15,1,1,""]},"crikit.preprocess.algorithms.abstract_als.AbstractBaseline":{calculate:[15,3,1,""],fix_rng:[15,3,1,""],setup:[15,3,1,""]},"crikit.preprocess.algorithms.als":{AlsCvxopt:[15,1,1,""]},"crikit.preprocess.algorithms.als.AlsCvxopt":{asym_param:[15,3,1,""]},"crikit.preprocess.algorithms.anscombe":{anscombe_inverse_exact_unbiased:[15,4,1,""],gen_anscombe_forward:[15,4,1,""],gen_anscombe_inverse_closed_form:[15,4,1,""],gen_anscombe_inverse_exact_unbiased:[15,4,1,""]},"crikit.preprocess.algorithms.arpls":{ArPlsCvxopt:[15,1,1,""]},"crikit.preprocess.crop":{CutEveryNSpectra:[14,1,1,""],ZeroColumn:[14,1,1,""],ZeroRow:[14,1,1,""]},"crikit.preprocess.crop.CutEveryNSpectra":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.crop.ZeroColumn":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.crop.ZeroRow":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.denoise":{SVDDecompose:[14,1,1,""],SVDRecompose:[14,1,1,""]},"crikit.preprocess.denoise.SVDDecompose":{calculate:[14,3,1,""]},"crikit.preprocess.denoise.SVDRecompose":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.standardize":{Anscombe:[14,1,1,""],AnscombeInverse:[14,1,1,""],calc_anscombe_parameters:[14,4,1,""]},"crikit.preprocess.standardize.Anscombe":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.standardize.AnscombeInverse":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.subtract_baseline":{SubtractBaselineALS:[14,1,1,""]},"crikit.preprocess.subtract_baseline.SubtractBaselineALS":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.subtract_dark":{SubtractDark:[14,1,1,""]},"crikit.preprocess.subtract_dark.SubtractDark":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.subtract_mean":{SubtractMeanOverRange:[14,1,1,""]},"crikit.preprocess.subtract_mean.SubtractMeanOverRange":{calculate:[14,3,1,""],transform:[14,3,1,""]},"crikit.preprocess.tests":{test_als:[16,0,0,"-"],test_anscombe:[16,0,0,"-"],test_baseline_sub:[16,0,0,"-"],test_crop:[16,0,0,"-"],test_subtract_dark:[16,0,0,"-"]},"crikit.preprocess.tests.test_als":{test_2Dbasic_redux_rng:[16,4,1,""],test_basic:[16,4,1,""],test_basic_redux:[16,4,1,""],test_basic_redux_rng:[16,4,1,""],test_basic_rng:[16,4,1,""],test_fix_ends:[16,4,1,""],test_fix_rng:[16,4,1,""],test_rng_redux_fix_rng:[16,4,1,""],test_rng_redux_fix_rng_vecasym:[16,4,1,""],test_vec_asym_param:[16,4,1,""],test_vec_asym_param_rng_redux:[16,4,1,""]},"crikit.preprocess.tests.test_anscombe":{make_datasets:[16,4,1,""],test_calc_ansc_params:[16,4,1,""]},"crikit.preprocess.tests.test_baseline_sub":{test_2Dbasic_redux_rng:[16,4,1,""],test_2Dbasic_transform_redux_rng:[16,4,1,""],test_basic:[16,4,1,""],test_basic_redux:[16,4,1,""],test_basic_redux_rng:[16,4,1,""],test_basic_rng:[16,4,1,""],test_fix_ends:[16,4,1,""],test_fix_rng:[16,4,1,""],test_rng_redux_fix_rng:[16,4,1,""],test_vec_asym_param:[16,4,1,""],test_vec_asym_param_rng_redux:[16,4,1,""]},"crikit.preprocess.tests.test_crop":{test_cut_every_n_spectra:[16,4,1,""],test_zero_col_first_col:[16,4,1,""],test_zero_col_last_col:[16,4,1,""],test_zero_row_first_row:[16,4,1,""],test_zero_row_last_row:[16,4,1,""]},"crikit.preprocess.tests.test_subtract_dark":{make_datasets:[16,4,1,""],test_sub_hsi_from_hsi:[16,4,1,""],test_sub_hsi_from_spectra:[16,4,1,""],test_sub_hsi_from_spectrum:[16,4,1,""],test_sub_hsi_int_from_hsi_float:[16,4,1,""],test_sub_spectra_from_hsi:[16,4,1,""],test_sub_spectra_from_spectra:[16,4,1,""],test_sub_spectra_from_spectrum:[16,4,1,""],test_sub_spectrum_from_hsi:[16,4,1,""],test_sub_spectrum_from_spectra:[16,4,1,""],test_sub_spectrum_from_spectrum:[16,4,1,""],test_transform_incompatible_dtypes:[16,4,1,""]},"crikit.ui":{classes_ui:[18,0,0,"-"],dialog_AbstractFactorization:[18,0,0,"-"],dialog_AbstractPlotEffect:[18,0,0,"-"],dialog_AnscombeParams:[18,0,0,"-"],dialog_SVD:[18,0,0,"-"],dialog_kkOptions:[18,0,0,"-"],dialog_model:[18,0,0,"-"],dialog_ploteffect:[18,0,0,"-"],dialog_save:[18,0,0,"-"],dialog_subResidualOptions:[18,0,0,"-"],dialog_varstabAnscombeOptions:[18,0,0,"-"],helper_plotOptions:[18,0,0,"-"],helper_roiselect:[18,0,0,"-"],main_Mosaic:[18,0,0,"-"],utils:[19,0,0,"-"],widget_ALS:[18,0,0,"-"],widget_ArPLS:[18,0,0,"-"],widget_Calibrate:[18,0,0,"-"],widget_Cut_every_n_spectra:[18,0,0,"-"],widget_DeTrending:[18,0,0,"-"],widget_Jupyter:[18,0,0,"-"],widget_KK:[18,0,0,"-"],widget_SG:[18,0,0,"-"],widget_images:[18,0,0,"-"],widget_mergeNRBs:[18,0,0,"-"],widget_scientificspin:[18,0,0,"-"]},"crikit.ui.classes_ui":{BW:[18,1,1,""],CompositeColor:[18,1,1,""],SingleColor:[18,1,1,""]},"crikit.ui.classes_ui.BW":{grayscaleimage:[18,3,1,""],image:[18,3,1,""],maxer:[18,3,1,""],mean:[18,3,1,""],minner:[18,3,1,""],set_x:[18,3,1,""],set_y:[18,3,1,""],std:[18,3,1,""],winextent:[18,3,1,""],x:[18,3,1,""],xlen:[18,3,1,""],y:[18,3,1,""],ylen:[18,3,1,""]},"crikit.ui.classes_ui.CompositeColor":{image:[18,3,1,""],mode_txt:[18,3,1,""],xlen:[18,3,1,""],ylen:[18,3,1,""]},"crikit.ui.classes_ui.SingleColor":{image:[18,3,1,""],imageGS:[18,3,1,""]},"crikit.ui.dialog_AbstractFactorization":{DialogAbstractFactorization:[18,1,1,""]},"crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization":{advance:[18,3,1,""],applyCheckBoxes:[18,3,1,""],clear:[18,3,1,""],combiner:[18,3,1,""],get_spatial_slice:[18,3,1,""],get_spectral_slice:[18,3,1,""],max_factors:[18,3,1,""],mean_spatial:[18,3,1,""],mean_spectral:[18,3,1,""],runScript:[18,3,1,""],setup:[18,3,1,""],setupData:[18,3,1,""],ui_changes:[18,3,1,""],unselected_factors:[18,3,1,""],updateCurrentRemainder:[18,3,1,""],updatePlots:[18,3,1,""]},"crikit.ui.dialog_AbstractPlotEffect":{AbstractPlotEffectPlugin:[18,1,1,""]},"crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin":{changed:[18,2,1,""],fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""]},"crikit.ui.dialog_AnscombeParams":{DialogCalcAnscombeParams:[18,1,1,""]},"crikit.ui.dialog_AnscombeParams.DialogCalcAnscombeParams":{dialogCalcAnscombeParams:[18,3,1,""],updateInputValues:[18,3,1,""],updateOutputValues:[18,3,1,""]},"crikit.ui.dialog_SVD":{DialogSVD:[18,1,1,""]},"crikit.ui.dialog_SVD.DialogSVD":{combiner:[18,3,1,""],dialogSVD:[18,3,1,""],get_spatial_slice:[18,3,1,""],get_spectral_slice:[18,3,1,""],max_factors:[18,3,1,""],mean_spatial:[18,3,1,""],mean_spectral:[18,3,1,""],s_from_selected:[18,3,1,""]},"crikit.ui.dialog_kkOptions":{DialogKKOptions:[18,1,1,""]},"crikit.ui.dialog_kkOptions.DialogKKOptions":{CARS_AMP:[18,2,1,""],NORM_TO_NRB:[18,2,1,""],NRB_AMP:[18,2,1,""],N_EDGE:[18,2,1,""],PAD_FACTOR:[18,2,1,""],PHASE_OFFSET:[18,2,1,""],dialogKKOptions:[18,3,1,""],goInteractive:[18,3,1,""]},"crikit.ui.dialog_model":{DialogModel:[18,1,1,""]},"crikit.ui.dialog_model.DialogModel":{changeSize:[18,3,1,""],dialogModel:[18,3,1,""]},"crikit.ui.dialog_ploteffect":{DialogPlotEffect:[18,1,1,""],widgetDemoPlotEffectPlugin:[18,1,1,""]},"crikit.ui.dialog_ploteffect.DialogPlotEffect":{TRANSPOSE_ARR:[18,2,1,""],dialogPlotEffect:[18,3,1,""],make_affected_plots:[18,3,1,""],make_orig_plots:[18,3,1,""],make_plots:[18,3,1,""],plot_labels:[18,3,1,""],widget_changed:[18,3,1,""]},"crikit.ui.dialog_ploteffect.widgetDemoPlotEffectPlugin":{fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""]},"crikit.ui.dialog_save":{DialogSave:[18,1,1,""]},"crikit.ui.dialog_save.DialogSave":{changeDataset:[18,3,1,""],changeFilename:[18,3,1,""],changePath:[18,3,1,""],dialogSave:[18,3,1,""],generateDatasetName:[18,3,1,""],generateFilename:[18,3,1,""],getFilename:[18,3,1,""],getPath:[18,3,1,""]},"crikit.ui.dialog_subResidualOptions":{DialogSubResidualOptions:[18,1,1,""]},"crikit.ui.dialog_subResidualOptions.DialogSubResidualOptions":{RESIDUAL_FREQ:[18,2,1,""],dialogSubResidualOptions:[18,3,1,""]},"crikit.ui.dialog_varstabAnscombeOptions":{DialogAnscombeOptions:[18,1,1,""]},"crikit.ui.dialog_varstabAnscombeOptions.DialogAnscombeOptions":{dialogAnscombeOptions:[18,3,1,""]},"crikit.ui.helper_plotOptions":{plotStyle:[18,1,1,""]},"crikit.ui.helper_plotOptions.plotStyle":{COLOR_DICT:[18,2,1,""],COLOR_VEC:[18,2,1,""],LINESTYLE_VEC:[18,2,1,""],LINESTYLE_VEC_STR:[18,2,1,""],LINEWIDTH:[18,2,1,""],MARKERSIZE:[18,2,1,""],MARKER_VEC:[18,2,1,""],MARKER_VEC_STR:[18,2,1,""],getLineStyle:[18,3,1,""],linestyle_str:[18,3,1,""],marker_str:[18,3,1,""],qcolor:[18,3,1,""]},"crikit.ui.helper_roiselect":{ImageSelection:[18,1,1,""]},"crikit.ui.helper_roiselect.ImageSelection":{append_selection:[18,3,1,""],clear_all:[18,3,1,""],num_selections:[18,3,1,""]},"crikit.ui.main_Mosaic":{DnDReorderListWidget:[18,1,1,""],MainWindowMosaic:[18,1,1,""]},"crikit.ui.main_Mosaic.DnDReorderListWidget":{dropEvent:[18,3,1,""],reordered:[18,2,1,""]},"crikit.ui.main_Mosaic.MainWindowMosaic":{addDataset:[18,3,1,""],check_for_spatial_calib:[18,3,1,""],check_for_spectral_calib:[18,3,1,""],closeEvent:[18,3,1,""],config:[18,2,1,""],deleteDataset:[18,3,1,""],frequency_calib:[18,2,1,""],init_internals:[18,3,1,""],is_duplicate_import:[18,3,1,""],lineEditPixChange:[18,3,1,""],list_reordered:[18,3,1,""],promote_demote_list_item:[18,3,1,""],save:[18,3,1,""],setupListWidget:[18,3,1,""],updateDatasets:[18,3,1,""],updateFrequency:[18,3,1,""],updateMosaicImage:[18,3,1,""],updateParams:[18,3,1,""],updateSlider:[18,3,1,""]},"crikit.ui.utils":{check_requirements:[19,0,0,"-"],roi:[19,0,0,"-"]},"crikit.ui.utils.check_requirements":{check_requirements:[19,4,1,""]},"crikit.ui.utils.roi":{roimask:[19,4,1,""]},"crikit.ui.widget_ALS":{widgetALS:[18,1,1,""]},"crikit.ui.widget_ALS.widgetALS":{asym_sub_val_change:[18,3,1,""],asymspinboxchanged:[18,3,1,""],fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""],selectFixedEnds:[18,3,1,""],selectWNIncrease:[18,3,1,""],setup_asym:[18,3,1,""],setup_smoothness:[18,3,1,""],spinBoxChanged:[18,3,1,""],weight_sub_val_change:[18,3,1,""],weightspinboxchanged:[18,3,1,""],x:[18,3,1,""]},"crikit.ui.widget_ArPLS":{widgetArPLS:[18,1,1,""]},"crikit.ui.widget_ArPLS.widgetArPLS":{fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""],selectFixedEnds:[18,3,1,""],spinBoxChanged:[18,3,1,""]},"crikit.ui.widget_Calibrate":{widgetCalibrate:[18,1,1,""]},"crikit.ui.widget_Calibrate.widgetCalibrate":{fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],meas_vs_ideal:[18,3,1,""],parameters:[18,2,1,""],setup_calib:[18,3,1,""],spinBoxChanged:[18,3,1,""]},"crikit.ui.widget_Cut_every_n_spectra":{widgetCutEveryNSpectra:[18,1,1,""]},"crikit.ui.widget_Cut_every_n_spectra.widgetCutEveryNSpectra":{cars_amp_offset:[18,2,1,""],comboBoxChanged:[18,3,1,""],fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],norm_to_nrb:[18,2,1,""],nrb_amp_offset:[18,2,1,""],pad_factor:[18,2,1,""],parameters:[18,2,1,""],phase_offset:[18,2,1,""],setupOptions:[18,3,1,""],spinBoxChanged:[18,3,1,""]},"crikit.ui.widget_DeTrending":{widgetDeTrending:[18,1,1,""]},"crikit.ui.widget_DeTrending.widgetDeTrending":{changeWidget:[18,3,1,""],widgetOptionsChanged:[18,3,1,""]},"crikit.ui.widget_Jupyter":{QJupyterWidget:[18,1,1,""]},"crikit.ui.widget_Jupyter.QJupyterWidget":{clearTerminal:[18,3,1,""],executeCommand:[18,3,1,""],printText:[18,3,1,""],pushVariables:[18,3,1,""]},"crikit.ui.widget_KK":{widgetKK:[18,1,1,""]},"crikit.ui.widget_KK.widgetKK":{cars_amp_offset:[18,2,1,""],changeCheckBoxConjugate:[18,3,1,""],changeCheckBoxLockBias:[18,3,1,""],changeCheckBoxNRBNorm:[18,3,1,""],changeShowReal:[18,3,1,""],fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],norm_to_nrb:[18,2,1,""],nrb_amp_offset:[18,2,1,""],pad_factor:[18,2,1,""],parameters:[18,2,1,""],phase_offset:[18,2,1,""],setupKK:[18,3,1,""],spinBoxChanged:[18,3,1,""]},"crikit.ui.widget_SG":{widgetSG:[18,1,1,""]},"crikit.ui.widget_SG.widgetSG":{changeOrder:[18,3,1,""],changeWinSize:[18,3,1,""],fcn:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""]},"crikit.ui.widget_images":{widgetBWImg:[18,1,1,""],widgetColorMode:[18,1,1,""],widgetCompositeColor:[18,1,1,""],widgetGrayScaleInfoBar:[18,1,1,""],widgetImageGainMath:[18,1,1,""],widgetPopSpectrumGS:[18,1,1,""],widgetSglColor:[18,1,1,""]},"crikit.ui.widget_images.widgetBWImg":{checkBoxFixed:[18,3,1,""],checkBoxRemOutliers:[18,3,1,""],comboBoxCompress:[18,3,1,""],createImg:[18,3,1,""],createImg_Ext:[18,3,1,""],initData:[18,3,1,""],spinBoxMinMaxSet:[18,3,1,""]},"crikit.ui.widget_images.widgetCompositeColor":{changeMode:[18,3,1,""],createImg:[18,3,1,""],createImg_Ext:[18,3,1,""],initData:[18,3,1,""]},"crikit.ui.widget_images.widgetImageGainMath":{COND_TYPE_STRINGS:[18,2,1,""],OPERATION_FREQ_COUNT:[18,2,1,""],OPERATION_STRINGS:[18,2,1,""],clear:[18,3,1,""],condOpsChange:[18,3,1,""],operationchange:[18,3,1,""]},"crikit.ui.widget_images.widgetSglColor":{applyGain:[18,3,1,""],changeColor:[18,3,1,""],disabled:[18,3,1,""],gain1:[18,3,1,""],initData:[18,3,1,""]},"crikit.ui.widget_mergeNRBs":{widgetMergeNRBs:[18,1,1,""]},"crikit.ui.widget_mergeNRBs.widgetMergeNRBs":{fcn:[18,3,1,""],fullRange:[18,3,1,""],kkChanged:[18,3,1,""],labels_affected:[18,2,1,""],labels_orig:[18,2,1,""],parameters:[18,2,1,""],pixChanged:[18,3,1,""],rangeChanged:[18,3,1,""],scaleChanged:[18,3,1,""],wnChanged:[18,3,1,""]},"crikit.ui.widget_scientificspin":{FloatValidator:[18,1,1,""],ScientificDoubleSpinBox:[18,1,1,""],format_float:[18,4,1,""],valid_float_string:[18,4,1,""]},"crikit.ui.widget_scientificspin.FloatValidator":{fixup:[18,3,1,""],validate:[18,3,1,""]},"crikit.ui.widget_scientificspin.ScientificDoubleSpinBox":{fixup:[18,3,1,""],stepBy:[18,3,1,""],textFromValue:[18,3,1,""],validate:[18,3,1,""],valueFromText:[18,3,1,""]},"crikit.utils":{breadcrumb:[20,0,0,"-"],datacheck:[20,0,0,"-"],general:[20,0,0,"-"],roi:[20,0,0,"-"],tests:[21,0,0,"-"]},"crikit.utils.breadcrumb":{BCPre:[20,1,1,""]},"crikit.utils.breadcrumb.BCPre":{PREFIX:[20,2,1,""],add_step:[20,3,1,""],attr_dict:[20,3,1,"id0"],backed_flag:[20,2,1,""],backed_up:[20,3,1,""],backup_pickle:[20,3,1,""],cut_list:[20,3,1,"id1"],dset_name_suffix:[20,3,1,""],id_list:[20,3,1,"id2"],load_pickle:[20,3,1,""],num_steps:[20,3,1,"id3"],pop_to_last:[20,3,1,""],process_list:[20,2,1,""]},"crikit.utils.general":{arange_nonzero:[20,4,1,""],expand_1d_to_ndim:[20,4,1,""],expand_1d_to_ndim_data:[20,4,1,""],find_nearest:[20,4,1,""],lin_from_row_col:[20,4,1,""],mean_nd_to_1d:[20,4,1,""],np_fcn_nd_to_1d:[20,4,1,""],pad:[20,4,1,""],pad_dual:[20,4,1,""],pad_edge_mean:[20,4,1,""],row_col_from_lin:[20,4,1,""],std_nd_to_1d:[20,4,1,""]},"crikit.utils.roi":{pts_in_path:[20,4,1,""],pts_to_verts:[20,4,1,""],verts_to_path:[20,4,1,""],verts_to_points_in_roi:[20,4,1,""]},"crikit.utils.tests":{test_breadcrumb:[21,0,0,"-"],test_general:[21,0,0,"-"],test_pad_edge_mean:[21,0,0,"-"]},"crikit.utils.tests.test_breadcrumb":{test_breadcrumb:[21,4,1,""],test_breadcrumb_offset:[21,4,1,""]},"crikit.utils.tests.test_general":{test_pad_1d:[21,4,1,""],test_pad_1d_0_width:[21,4,1,""],test_pad_2d:[21,4,1,""],test_pad_2d_0_width:[21,4,1,""],test_pad_dual_1d:[21,4,1,""],test_pad_dual_1d_all_0s:[21,4,1,""],test_pad_dual_2d:[21,4,1,""]},"crikit.utils.tests.test_pad_edge_mean":{test_pad_1d:[21,4,1,""],test_pad_1d_0_width:[21,4,1,""],test_pad_2d:[21,4,1,""],test_pad_2d_0_width:[21,4,1,""]},crikit:{CRIkitUI:[3,0,0,"-"],cri:[4,0,0,"-"],data:[7,0,0,"-"],datasets:[9,0,0,"-"],io:[10,0,0,"-"],measurement:[12,0,0,"-"],preprocess:[14,0,0,"-"],transform:[17,0,0,"-"],ui:[18,0,0,"-"],utils:[20,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:function"},terms:{"0001":15,"0006":2,"001":18,"002":2,"004":2,"038483":[22,23],"06543":[3,4,5,14,18],"100":[2,4,14,15,18,27],"1000":[12,15,27],"1002":[2,5],"1003":2,"1019":2,"1029":2,"103":2,"105":[22,25],"109":15,"1109":[14,15],"1133":2,"1147":2,"1167":2,"1173":2,"1363":[2,4,5,18],"1365":[2,4,5,18],"1500":18,"1507":[3,4,5,14,18],"1600":2,"165955456":18,"1948":15,"1975":2,"1998":[14,15],"1999":5,"1e3":[18,27],"1qt5":[22,23],"1st":12,"2005":[2,4],"2007":2,"2009":[2,4,5,15,18],"2010":15,"2011":[2,15],"2012":[14,15],"2013":2,"2014":2,"2015":18,"2016":[2,3,4,5,7,10,12,14,15,18,20,22],"2017":[22,23],"2056693":15,"2202675":[14,15],"2213":2,"246":15,"254":15,"2700":2,"2733":2,"2739":2,"2800":18,"2qt5":[22,23],"300":2,"3000":2,"3qt5":[22,23],"400":18,"408":[2,4,5,14,22],"415":[2,4,5,14],"416":22,"443199618":2,"461":18,"4824":5,"500":27,"513":2,"525":2,"5278406":15,"540":2,"5510120093941":18,"5qt5":[22,23],"601":[2,4,18],"627":2,"634":2,"700":18,"745":3,"767":2,"771":18,"786":2,"809":2,"832":18,"900":2,"902":2,"937":2,"980":2,"986":2,"abstract":[12,18],"break":18,"case":[4,5,25],"class":[3,4,7,9,10,11,12,14,15,22],"default":[2,4,5,7,12,14,15,18],"final":9,"float":[4,5,7,12,14,15,16,18,20],"function":[2,3,4,5,7,18,20,22,23],"import":[2,8,10,11,27],"int":[4,5,7,9,12,14,15,18,20],"long":7,"m\u00e4kitalo":[2,14,15],"new":[2,3,7,18,20,22,23],"public":[22,25],"return":[2,4,5,7,9,10,12,14,15,18,19,20,22],"short":2,"static":[4,8,12,18,20],"true":[2,3,4,5,7,12,14,15,18,20],"try":4,ABS:18,ALS:[2,4,18],AND:[8,22],Are:4,BUT:22,FOR:22,For:[2,3,4,5,7,12,18,20],JRS:4,NOT:[4,7,20,22],Not:7,One:2,SVs:18,THAT:22,THE:22,That:[20,23],The:[4,5,7,14,15,20,22,23],Their:2,There:[2,22,23],These:[2,22,23],USE:22,Use:10,Used:18,Useful:7,Uses:[2,10],Using:[6,13],WAS:22,WILL:22,WITH:[8,22],Was:14,_colormath:18,_dataset_nam:18,_factor:7,_list_:7,_mplwin:18,_np:5,_rc:[22,23],a_0:7,a_1:7,a_2:7,a_n:7,a_vec:7,about:25,abs:[5,13],absolut:12,abstract_:[3,14],abstractbaselin:15,abstractmeasurethre:12,abstractmeasuretwo:12,abstractmeasuretwoord:12,abstractploteffectplugin:18,accept:[7,20],access:[2,23],account:[2,7],accur:2,accuraci:[2,22],acquir:[2,3],across:[2,7,12],act:18,action:[3,14,18,22],activ:[3,18],actual:[2,18],add:[2,13,18,20,23],add_step:20,adddataset:18,addit:[2,12,20],addition:2,addl_attr:20,adjust:18,advanc:18,advis:[22,23],affect:[18,22],after:[2,3,5,14,20],again:2,agenc:22,agre:7,aid:2,aka:[3,14],alessandro:15,algebra:2,algorithm:[3,4,14,16,18,22],all:[2,3,12,14,18,19,20,22],allow:[2,7,18],allow_dupl:18,along:20,alpha:[2,14],alreadi:14,als:[3,14],alscvxopt:15,also:20,alter:[14,15],altern:[22,23],alwai:7,amazonaw:2,amp:[3,12,18],amplif:14,amplitud:[2,3,4,12,13,18],anal:2,analysi:[2,3,14,15],analyt:[6,13],analyz:3,andrew:2,ani:[2,7,18,22,25],anoth:20,anscomb:[3,14,16,18,22],anscombe_inverse_exact_unbias:15,anscombeinvers:14,anti:[2,3,4,5,14,18,22],anyth:[4,5,8,23],api:[22,23],apidoc:[22,23],appar:[22,23],appear:[2,22,23],append:[7,18,20,23],append_select:18,appl:2,appli:[2,3,4,5,14,15,18,21],applycheckbox:18,applygain:18,approach:18,appropri:[3,18],approx:15,approxim:[2,3,15],apr:[7,14],arang:[20,27],arange_nonzero:20,arg:[3,18],argument:18,aris:22,aros:22,around:[2,20,22,23],arpl:[3,14,18],arplscvxopt:15,arrai:[3,4,5,7,14,20],arxiv:[3,4,5,14,18],ask:2,assert:8,associ:10,assum:[2,4,5,7,14,15,23,25],assymetri:18,asym_param:[4,14,15,18],asym_sub_val_chang:18,asymetri:18,asymmetr:[2,4,8,14,18],asymmetri:[2,4,14,18],asymspinboxchang:18,attr:20,attr_dict:[7,20],attribut:[7,10,20],august:15,author:[4,7,10,12,14,15,18,20,26],auto:[3,12],automat:[4,5],avail:25,averag:[2,3,14,18,20],avoid:22,awgn:2,axes:8,axi:[4,5,7,14,18,19,20],axison:18,aysmmetr:16,back:[2,3,7,20],backed_flag:20,backed_up:20,background:[2,4,5],backup:[3,20],backup_pickl:20,bad_valu:[4,5],balanc:12,banner:18,bar:18,base:[2,3,4,7,9,12,14,15,18,20,22],baselin:[2,3,4,14,18],basic:21,bat:[22,23],bcar:[3,10,18,22],bcpre:20,been:2,befor:[2,5,14,18],being:[2,18],below:[4,5,7,15],best:25,between:[2,4,12,13,14],bia:2,big:8,bijaoui:[14,15],binari:19,binomi:15,bio:2,biolog:2,biometrika:15,bisect:2,black:2,blank:7,blend:2,block:2,blue:18,boca:5,boelen:[2,4],bool:[3,4,5,7,10,14,18],borri:2,both:2,boundari:20,box:[2,18],breadcrumb:[3,21,26],broadband:[2,4,5,18],browser:23,bug:[22,23],built:[22,23],burden:2,burnden:4,button:[2,3],buttonid:18,calc:12,calc_anscombe_paramet:14,calcanscombeparam:3,calcul:[2,3,4,5,7,12,14,15,16,18],calib:7,calib_data_agre:7,calib_dict:18,calib_fcn:7,calib_obj:7,calib_orig:7,calib_pix_wl:7,calib_pix_wn:7,calib_vec:18,calib_wl:18,calibr:[3,7,18,22],calibrationreset:3,call:18,cambridg:[14,15],camp14:2,camp16:2,camp:[2,3,4,5,14,18,22],can:[2,5,7,8,18,20,22,23],cancel:2,canva:18,car:[2,3,4,5,14,18,22],cars_amp:18,cars_amp_offset:[4,18],cauchi:[6,13],caus:2,ccampjr:[22,23],ceas:4,center:[2,7],center_wl:18,certain:[2,22,23],chanc:14,chang:[2,3,18],changecheckboxconjug:18,changecheckboxlockbia:18,changecheckboxnrbnorm:18,changecolor:18,changedataset:18,changefilenam:18,changemod:18,changeord:18,changepath:18,changes:18,changeshowr:18,changeslid:3,changewidget:18,changewins:18,characterist:25,charl:[3,22],chc:[4,7,10,12,14,15,18,20],check:[2,3,7,18,19,20],check_for_spatial_calib:18,check_for_spectral_calib:18,check_requir:[3,18],checkbox:18,checkboxfix:18,checkboxremoutli:18,checkcompositeupd:3,checkshowoverlai:3,chem:2,choos:23,chunk:8,ciceron:[2,3,4,5,14,18,22],circl:18,cite:15,classes_ui:[3,26],classmethod:12,clean:23,clear:18,clear_al:18,cleartermin:18,click:[2,3],clone:22,close:[2,3,15],closeev:[3,18],closest:[7,20],cmap:18,code:[22,25],coeffici:7,coher:[2,3,4,5,14,18,22],col:20,collabor:25,collect:[2,7],color:[3,7,18,22],color_dict:18,color_vec:18,column:[3,5,8,14],com:[2,18,22,23],combin:18,combobox:18,comboboxabovemax:18,comboboxchang:18,comboboxcompress:18,come:[2,3],command:[3,18,22,23],compar:[2,3,4,5,14,18,22],comparitor:2,complet:2,complex:[2,3,5,9,12,14,22],compon:[2,4,5,14,18,22],componenet:14,compos:22,composit:[3,18],compositecolor:18,compress:18,comput:[2,4,5,7,14],concern:18,cond_type_str:18,conda:23,condinequalitychang:3,condit:[2,3],condopchang:3,condopschang:18,config:[7,18],configur:10,conform:22,conjug:[4,5,14,18],connect:[2,3,22],consequenti:22,consid:[4,22],consol:18,constant:[2,4,18,20],constant_pad_width:20,construct:18,contain:[2,7,18,20,22],content:[22,26],contentpag:2,contract:22,contradictori:7,contribut:[2,14],control:[5,18],conveni:[7,18],convers:[2,10],convert:[2,7,16,20,22],coordin:[12,20],copi:[5,14],copyright:[22,25],core:3,correct:[3,4,5,6,14,18,19,22],correspond:[4,18],count:[15,20],counter:20,cours:25,cplx:18,crc:5,creat:[4,7,10,12,14,15,18,19,20,23],createimg:18,createimg_ext:18,createimgbw:3,cri:[3,18,22,26],crikit2:2,crikit:[22,23,26,27],crikit_launch:[3,27],crikitui:[26,27],crikitui_process:3,crop:[3,8,18,26],cross:2,csv:10,csv_nist:[3,26],csv_nist_import_data:10,ctr:7,ctr_wl0:7,ctr_wl:7,cube:18,current:[2,7,14,18,20],current_dataset_nam:18,current_filenam:18,current_path:18,cursor:2,custom:2,custombann:18,cut:[3,14,18,20],cut_list:20,cut_m:[14,18],cuteverynspectra:[3,14,18],cutoff:12,cutoff_d1:12,cutoff_d2:12,cvxopt:[22,23],cwt_diff:12,cwt_width:12,cyan:[2,18],damag:22,dark:[3,14,16,18,22],dark_arrai:[14,18],dark_sub:18,dark_subtract:14,dash:18,data:[3,4,5,10,12,14,15,16,18,20,22,26,27],data_in:18,data_obj:14,data_to_match:20,databas:2,datacheck:[3,26],dataset:[3,8,10,13,16,18,20,22,26],dataset_nam:3,dataset_name_path:18,datasetnam:20,deactiv:3,deal:7,debat:7,dec:[15,18],decompos:[2,14],decomposit:[14,22],defin:[2,7,8,20],degelder07:2,delet:[22,23],delete_preview_roi:3,deletedataset:18,deleteoverlai:3,demo:18,demonstr:2,denois:[3,15,22,26],denoisedark:3,denoisenrb:3,denot:10,depend:3,deriv:[4,7,12,14,18],derviv:2,describ:[7,14,19,20,22,23],descript:15,descriptor:7,desid:7,desir:23,detector:[2,18],determin:2,detrend:[2,3,14,16,18],dev:2,develop:[1,22,25],development:[22,23],deviat:[2,7,14,15,18],diagon:14,dialog:[2,3],dialog_abstractfactor:[3,26],dialog_abstractploteffect:[3,26],dialog_anscombeparam:[3,26],dialog_kkopt:[3,26],dialog_model:[3,26],dialog_ploteffect:[3,26],dialog_sav:[3,26],dialog_subresidualopt:[3,26],dialog_svd:[3,26],dialog_varstabanscombeopt:[3,26],dialogabstractfactor:18,dialoganscombeopt:18,dialogcalcanscombeparam:18,dialogdarkopt:18,dialogkkopt:18,dialogmodel:18,dialogploteffect:18,dialogsav:18,dialogsubresidualopt:18,dialogsvd:18,diamond:18,diamondd:18,dict:[4,5,7,10,14,18,20],dictionari:[7,18,20],differ:[2,4,12,18],digit:2,dimenens:9,dimens:[7,20],dimension:[5,20],diment:5,direct:[12,15,22],directli:12,directori:[3,22,23],disabl:18,disclaim:22,discontinu:4,disk:20,displai:[2,3,18,23],distort:[2,12],distribut:[2,22,23],divi:8,divis:[12,13],dlm:3,dndreorderlistwidget:18,doc:[22,23],docomposit:3,docstr:14,doe:[2,4,7,8,22,25],doesn:18,doi:[5,14,15],dokk:3,domain:[2,4,5,18,22,25],domath:3,dot:18,doundo:3,down:[2,8,11,13,14,16,18],download5:[22,23],download:[22,23],drag:18,drop:[2,18],dropev:18,dset:[10,18],dset_list:10,dset_name_suffix:20,dtype:[7,9,16,20],due:16,dump:20,dure:[2,7],duti:25,dynam:7,each:[2,4,14,18,20],easili:23,edg:[2,4,5,7,20],edge_pad_width:20,edit:2,effec:5,effect:[4,7,14,15,18],eiler:[2,4],eilers05:2,either:[2,3,20,22],elastin:2,element:[7,14,20],els:14,elsewher:23,employe:[22,25],enabl:[2,7,23],end:[2,3,4,18,23],endors:25,endpoint:18,enforc:4,enough:2,ensur:8,enter:[2,3,18,22],entri:[3,7,10,20,22,23],equal:[4,18,20],err:2,error:[3,4,5,6,8,14,18,22],error_correct:[3,26],errorcorrectamp:3,errorcorrectphas:3,errorcorrectscal:3,estim:2,etc:[7,18],even:[2,7,14],event:22,everi:[2,3,14,18],every_n:[14,18],everyth:20,exact:[2,4,14,15],exampl:[2,7,18,27],except:[7,20],excit:2,exclud:20,exe:23,execut:[3,18],executecommand:18,exhaust:1,exist:3,expand:[2,20],expand_1d_to_ndim:20,expand_1d_to_ndim_data:20,expans:2,expens:2,experi:2,experiment:2,explicitli:2,explor:2,express:[22,25],extens:[2,18],extent:[7,18],extern:2,extract:2,extrem:2,extrema:4,f_full:7,f_label:[3,27],f_pix:7,f_unit:[3,27],factor:[2,3,4,14,18,26],factorizedhsi:7,factorizedspectra:7,fail:14,fall:20,fals:[2,3,4,5,7,14,15,18,20],far:18,faster:[7,14],fcn:[7,18,20],featur:2,feder:[22,25],fee:22,feel:2,feet:27,few:22,fft:12,fftsignalmetr:12,fftspatialnois:[3,26],figur:18,file:[3,8,10,11,18,20,22,23],filenam:[3,10,18,20],filename_data:10,filename_head:10,fileopendlmnist:3,fileopenhdfnist:3,fileopenhdfnistooc:3,fileopensuccess:3,fill:2,filter:[2,18],find:[2,7,12,14,20],find_nearest:20,fine:2,fingerprint:2,finish:2,finland:15,first:[2,3,10,14,18],first_or_last:14,fit:[2,22],fix:[2,18,22,23],fix_const:[4,14,15,18],fix_end_point:[4,14,15,18],fix_rng:[4,14,15,18],fixup:18,flag:20,flip:8,floatvalid:18,fname:20,foi13:2,foi:[2,14,15],follow:[20,23],font:[22,23],forc:[4,5,22,23],form:[15,18],format:[18,20],format_float:18,formerli:[3,22],formula:5,forward:[2,14,15],fourier:[2,5],fourth:2,frame:18,free:[2,22],freedom:22,freeli:22,freq:[2,3,4,7],freq_vec:7,freqcalib:3,freqcaliborig:3,frequenc:[2,3,4,5,9,18,26,27],frequency_calib:18,freqwindow:3,fri:[7,12,14],from:[3,4,5,7,10,14,18,19,20,22,23],fsignal:15,full:[1,3,5,7],fulli:2,fullrang:18,g_mean:14,g_std:14,gain1:18,gain:[2,18],gauss:[14,15],gauss_mean:[14,15],gauss_std:[14,15],gaussian:[2,14,15,18],gelder:2,gen_anscombe_exact_unbias:15,gen_anscombe_forward:15,gen_anscombe_inverse_closed_form:15,gen_anscombe_inverse_exact_unbias:15,gener:[3,14,15,18,21,22,23,26],generatedatasetnam:18,generatefilenam:18,get:[3,22,23],get_closest_freq:7,get_index_of_closest_freq:7,get_preview_spectra:3,get_rand_spectra:7,get_spatial_slic:18,get_spectral_slic:18,getfilenam:18,getlinestyl:18,getpath:18,gist:18,git:23,github:[18,22,23],given:[4,7,18,20],glass:2,global:5,goe:18,gointeract:18,golai:[2,3,4,18],gov:[3,22],govern:[22,25],grant:22,graphic:22,grayscal:[3,18],grayscaleimag:18,green:18,guarante:25,gui:[3,22,23],gussem:2,h5py:[22,23],haar:12,half:2,handbook:5,harm:2,hartshorn:2,has:[2,6,13,14,18],have:[16,18],hdf5:[3,8,11,18,20,26],hdf:[3,10,20],hdf_dataset2:8,hdf_dataset:11,hdf_import_data:10,hdftoclass:20,header:[10,23],heddleston:2,height:18,help:[2,23],helper_plotopt:[3,26],helper_roiselect:[3,26],here:2,herebi:22,hereund:22,hermiti:14,hexagon:18,high:[2,4,5],higher:[4,7],highest:[7,10],highli:4,hight:2,hilb_kwarg:[4,5],hilbert:[2,4,5,6,13],hilbertfft:5,horiz:18,how:6,howev:2,hsi:[3,8,9,11,13,14,16,18,20,22,26,27],hsi_dataset:13,hsi_i:9,hsi_r:9,html:[22,23],http:[2,5,15,18,22,23],huang:2,hyperspectr:[2,7,26],icon:3,id_list:20,ideal:2,ident:22,identif:25,identifi:[2,18,20,25],idx:7,ieee:[2,14,15],ies:7,ignor:2,imag:[2,7,9,12,14,15,18,26,27],imageg:18,imageri:[3,7,18,22],imageselect:18,imaginari:[3,4,5,12,14,18,22],img:[3,7,12,18],img_al:18,img_shap:18,img_shp:12,imgi:19,imgload:18,imgx:19,implement:[2,5,7,14,18],impli:[22,25],implicitli:2,import_csv_nist_special1:10,import_hdf_nist_speci:10,improv:2,in_freq:7,incid:2,includ:[22,23],inclus:[7,12],incompat:16,incorpor:2,increas:[2,4,5,18],increment:2,independ:[2,7,18],index:[1,4,5,7,20,22],indic:2,indirect:22,individu:[22,23],inequ:3,inf:[4,5],info:18,inform:[2,14,22],infring:22,init_intern:18,initdata:18,initi:[7,18],injuri:22,input:[4,5,7,12,14,18,20,22],instal:19,instanc:[3,7,18],instanti:11,instead:20,institut:[22,25],integ:7,intens:[7,14,18],inter:2,interact:[2,3,22],intercept:18,interest:[1,3,7,19],interfac:[2,3,22],intern:18,interpol:[3,4],intrins:2,inv:2,invers:[3,14,15,22],inverseanscomb:3,involv:2,ipython:[18,22],is2d:7,is3d:7,is_duplicate_import:18,isclos:20,issamedim:7,item:7,iter:[2,4,18],its:[22,25],januari:[15,22,23],jdreaver:18,journal:[3,4,5,14,18,22],jrs:5,jul:18,jun:[4,12,14,20],jupyt:22,just:[3,8,14,22],karuna16:2,karuna:2,keep:2,kei:[7,10],kept:2,kind:22,kkchang:18,kkrelat:5,kramer:[3,4,6,18,22],kramerskronig:4,kronig:[3,4,6,18,22],kwarg:[3,4,5,14,15,18],label:[3,7,18],labels_affect:18,labels_orig:18,lambda:[2,14,18],langbein:2,larg:[2,7],larger:7,last:[2,3,14],lathia:2,launch:3,lazyhdf5:[22,23],lead:[14,18],least:[2,4,14,16,18],lee11:2,lee:[2,3,4,5,14,18,22],left:[2,3,4,5,18],left_side_scal:4,length:[2,4,5,7,18],less:[4,18],let:18,lett:[2,4,5,18],level:[2,14,15],liabl:22,librari:19,lighter:2,like:[1,4,5,18],limit:[3,7,18,22],lin_from_row_col:20,linalg:14,line:[2,3,18,22],linear:[2,3,20],linearsegmentedcolormap:18,lineeditfreqchang:3,lineeditpixchang:[3,18],linestyle_str:18,linestyle_vec:18,linestyle_vec_str:18,linewidth:18,linspac:27,list:[1,7,10,18,20],list_reord:18,listwidget:18,liu09:2,liu:[2,4,5,18],live:18,llc:5,lnla:15,load:[3,18,20],load_pickl:20,loaddark:3,loaddarkdlm:3,loadnrb:3,loadnrbdlm:3,local:15,locat:[2,3,12,19],log:2,long_nam:18,longer:[2,18,27],look:2,lorentz:[6,13],lose:23,loss:22,low:[4,5,15],macro:[3,26],made:2,magenta:[2,18],magnitud:2,mai:[2,7,10,14,20,22,23],main:[2,3],main_mosa:[3,26],mainwindow:18,mainwindowmosa:18,make:[2,7,9,20,22,23,25],make_affected_plot:18,make_dataset:[8,16],make_hsi:9,make_orig_plot:18,make_plot:18,make_spectra:9,makebcarsphantom:3,makeramanphantom:3,mani:[2,20],manner:4,manual:[2,3,18,22,23],mar:18,mark:20,marker_str:18,marker_vec:18,marker_vec_str:18,markers:18,markku:15,masia:2,mask:[7,18,19,20],match:[4,7,14,15,20],materi:2,math:[2,3,4,6,12,13,18],mathemat:18,matlab:15,matplotlib:[18,19,22,23],matric:[2,5],matrix:[2,5,14,18],matter:[2,22,23],max:[2,18],max_factor:18,max_it:[4,14,15,18],maxab:18,maxer:18,maximum:[3,4,12,13,18],mean:[2,3,4,5,7,14,15,16,18,20],mean_axes_stat:8,mean_nd_to_1d:20,mean_spati:18,mean_spectr:18,meas_vs_id:18,measur:[2,3,7,22,26],measurepeak:12,measurepeakadd:12,measurepeakbwtrough:12,measurepeakdivid:12,measurepeakmax:12,measurepeakmaxab:12,measurepeakmin:12,measurepeakminab:12,measurepeakminu:12,measurepeakmultipli:12,measurepeaksum:12,measurepeaksumabsreimag:12,meausur:12,median:2,memori:[2,5],merchant:22,merg:[3,4,18],merge_nrb:[3,26],mergenrb:[3,4,18],met:2,meta:[7,10,18],meta_config:[3,26],meta_process:[3,26],metadata:20,method:[2,3,6,7,8,12,13,18],metric:12,microscopi:2,migler:2,mimic:18,min:[2,18],min_diff:[4,14,15,18],min_valu:[4,5],minab:18,minim:[2,7],minimum:[2,4,12,13],minner:18,minor:[2,15],minu:2,minut:2,mix:[2,14,15],mnadatori:20,mode:[18,20,23],mode_txt:18,model:[2,3,7,14,15,26],modif:23,modifi:[18,22],modul:[1,22,26],modulu:5,moen:2,molecul:2,mon:[2,4,10,15,18],moon:2,more:[2,4,10,14],mosaic2d:7,mosaic:[3,18,26],mosaic_mask:7,mosaic_shap:7,mosaicful:7,mosaictool:3,most:[1,2,20],mous:[2,3],move:20,mpl:[3,19],mpl_kwarg:18,mts:7,multi:23,multipl:[2,4,5,7,12,13,14,18],multipli:[2,14,15],murin:2,murtagh:[14,15],must:[2,7],n_edg:[4,5,18,20],n_lambda:14,n_noise_test:12,n_pix:7,n_spectra:14,nacl:2,name:[3,10,18,20],nan:[4,5],narendra75:2,narendra:2,nat:2,nation:[22,25],nd_axi:7,nd_fcn:7,ndarrai:[3,4,5,7,9,10,12,14,15,18,19,20],ndim:[7,20],nearest:20,nearest_valu:20,necessari:[2,19,23],necessarili:25,need:[2,18,20,22,23],neg:15,neighbor:[4,5],next:[2,18],nist:[2,3,10,22,25],nmf:2,no_it:5,nois:[2,12,14,15,18],noise_sigma:12,noiseless:2,noisi:15,non:[2,3,14,15,20],none:[4,5,7,9,10,12,14,15,18,20],nonlinear:2,nonneg:2,nonreson:[2,4],nor:25,norm_to_nrb:[4,5,18],normal:[4,5,14,18,22],note:[2,3,4,5,7,8,12,14,15,16,18,20,22,23],notic:22,nov:4,now:[2,22,23],np_fcn_nd_to_1d:20,np_vec:20,nrb:[3,4,5,18,22],nrb_amp:18,nrb_amp_offset:[4,18],nrb_left:[4,18],nrb_right:[4,18],nrbfromroi:3,nrbload:18,nuclei:2,num:[3,7,18],num_current_plot:18,num_select:18,num_step:20,number:[4,5,7,18,20],numcolor:3,numer:[3,12,18,22],numpi:[3,5,9,14,20,22,23,27],obj:7,object:[4,7,9,10,12,14,15,18,19,20],occur:3,oct:18,octagon:18,odd:2,offici:25,offset:[2,4,5,14,18,20,21],old:[22,23],older:[22,23],one:[2,5,7,20,22,23],onli:[2,3,4,5,7,18,20],op_list_:7,op_list_freq:7,op_list_pix:7,op_rang:7,op_range_:7,op_range_freq:7,op_range_pix:7,op_siz:7,opchang:3,open:[2,3,25],oper:[2,3,7,14,18,20],operar:7,operation_freq_count:18,operation_str:18,operationchang:18,oppos:5,opposit:18,opt:[2,4,5,18],optic:2,optim:[2,14,15],option:[4,5,7,12,14,15,18,20],order:[2,4,12,14,15,18,25],org:5,orient:[4,5],origin:[5,7,14,15,18,20],other:25,otherwis:[18,22],out:[3,5,7,18,20,22,23],outer:2,output:[3,4,5,12,18,22],output_cls_inst:10,over:[3,4,5,7,14,18],over_spac:7,overview:22,overwrit:[4,5,7,14],own:22,packag:[22,23,26],pad:[2,4,5,18,20],pad_dual:20,pad_edge_mean:[20,21],pad_factor:[4,5,18],pad_width:20,pair:[7,18,20],pancrea:2,panel:18,paramet:[2,3,4,5,7,9,10,12,14,15,16,18,19,20],parent:18,part:[12,22],parti:25,particular:[2,10,18,22],pass:7,patch:2,path:[3,10,18,19,20],patterson75:2,patterson:2,pca:2,pdf:2,peak:[2,12,13,18],peakamp:[3,26],peakfind:[3,26],pec:4,penal:18,pentagon:18,perform:[2,3,4,5,7,12,14,18,22,25],permiss:22,person:22,phantom:[3,18,22],phase:[3,4,6,14,18,22],phase_offset:[4,5,18],phaseerrcorrect:4,phenylalanin:2,photon:2,physic:[7,19],pickl:20,piec:2,pip3:[22,23],pipermail:[22,23],pix:[4,7],pix_vec:7,pixchang:18,pixel:[2,3,4,7,12,14,18,20],place:16,plai:6,plain:18,platform:[3,22],pleas:15,plot:[2,3,7,18,22,23],plot_label:18,plot_list_:7,plot_list_freq:7,plot_list_pix:7,plot_rang:7,plot_range_:7,plot_range_freq:7,plotdarkspectrum:3,ploteffect:18,ploteffectplugin:18,plotleftnrbspectrum:3,plotnrbspectrum:3,plotrightnrbspectrum:3,plotstyl:18,plotter:2,plotter_show:3,plu:[2,18],plug:18,plugin:18,point:[2,3,4,18,19,20],pointspectrum:3,poisson:[2,14,15,18],poisson_multi:[14,15],polygon:3,polyhedrom:2,polyhedron:2,polym:2,polynomi:[2,7,18],polyord:18,pop:[2,3,18],pop_to_last:20,portion:[2,3,14,22],posit:14,potenti:2,poularika:5,pre:[2,3,20,22,23],prefix:[7,20],preprocess:[3,22,26],present:[3,18],press:[2,3,5,14,15],prevent:[4,22,23],preview:[2,3],preview_roi:3,previou:20,previous:[4,18],primari:[2,3],principl:2,print:[7,18],printtext:18,prior:[2,4,18],prioriti:10,probabl:23,probe:[7,18],proc:15,process:[3,4,10,14,15,18,20,22],process_desc:20,process_list:20,produc:2,product:[2,25],profil:2,program:18,project:25,promote_demote_list_item:18,properli:2,properti:[4,7,9,12,15,18,20,22],protect:[22,25],protein:2,provid:[2,4,5,7,11,14,22],pseudo:22,pt_sz:7,pth:10,pts_in_path:20,pts_to_vert:20,pull:[22,23],pure:22,purpos:[7,22,25],pursuant:[22,25],push:[4,18,23],pushbutton:2,pushvari:18,pyqt5:[3,18,22,23],python3:[3,22,23,27],python:3,pyuic5:[22,23],qcloseev:[3,18],qcolor:18,qdialog:18,qdoublespinbox:18,qdropev:18,qjupyterwidget:18,qlistwidget:18,qmainwindow:[3,18],qobject:18,qt5:[22,23],qt_:[22,23],qtconsol:18,qtgui:18,qtwidget:[3,18],quad:7,quadrat:2,qualiti:25,quandrant:2,quantifi:12,quantit:[2,3,4,5,14,18,22],queri:10,qvalid:18,qwidget:18,rais:[2,8,16],raman:[3,4,5,14,18,22],randn:27,random:27,rang:[3,4,7,8,12,14,18],rangechang:18,rather:[1,3,4,8,10,18,23],ratio:[2,4,5,12],raton:5,raw:[2,3,18],read:[7,20],readili:2,real:[2,4,5,9,12,18,22],rebuild:22,recalc_cutoff:12,recent:20,recommend:[2,4,25],recompos:[2,14],reconstruct:[2,14,18],red:18,reduc:[2,4],reduct:18,redux:[4,14,15,18],redux_factor:14,ref:4,refer:[3,4,5,14,15,18,22],reflect:2,region:[3,7,19,20],regular:18,rel:[14,23],relat:[4,6,13,18,22],relationship:[2,5,12],releas:[3,22,23],reliabl:25,remain:[14,18],rememb:2,remov:[4,18,20],reorder:18,rep:7,rep_arrai:[14,18],repetit:[7,14,18],replac:[14,18],replic:[3,14,26],repons:[4,18],requir:[2,3,22,23],reset:18,reshap:8,resid:18,residu:[3,18],residual_freq:18,resolut:2,reson:2,respond:3,respons:25,rest:20,restor:2,result:[2,18,22],retriev:[3,4,6,14,18,22],return_pad:5,reveal:2,reweight:18,ribbon:[2,3],rich:2,rich_jupyter_widget:18,richjupyterwidget:18,right:[2,3,4,5,13,18],riverbankcomput:[22,23],rlate:18,rng:[4,14,15,18],roi:[3,18,26],roimask:19,roispectrum:3,root:5,rosetta:10,rosetta_queri:10,routin:15,row:[3,8,14,20],row_col_from_lin:20,run:[8,18,22],runscript:18,s_from_select:18,salt:2,same:[12,14],sampl:[2,4,8,11,13,14,18],sat:[14,18,20],save:[3,22],save_dataset_nam:18,save_filenam:18,save_path:18,savitki:[2,3,4,18],scale:[3,4,6,14,15,22],scale_left:18,scalechang:18,scaleerrcorrectsg:4,scatter:[2,3,4,5,14,18,22],scienc:2,scientificdoublespinbox:18,scientificspin:18,scipi:23,sciplot:[18,22,23],scm:23,screenshot:2,script:18,section:[22,25],see:[1,4,7,14,18,22,23],select:[2,3,14,18,19],selectfixedend:18,selector:18,selectwnincreas:18,self:[3,18,20],sender:3,sent:[4,5],sep:10,separ:[2,4,12,18],seri:[2,8,16],servic:22,set:[2,3,4,5,7,9,10,14,18],set_i:18,set_preview_roi:3,set_x:18,setcondfreq1:3,setcondfreq2:3,setcondfreq3:3,setopfreq1:3,setopfreq2:3,setopfreq3:3,setup:[3,8,11,13,15,16,18,23],setup_asym:18,setup_calib:18,setup_smooth:18,setupdata:18,setupkk:18,setuplistwidget:18,setupopt:18,sever:[2,4,18],sgl_color_list:18,sgl_color_widget_list:18,shade:2,shall:22,shape:[7,14,15],shell:22,shift:18,shot:2,should:[2,4,5,7,23],shoulder:12,show:[2,18,22,23],showcbar:18,shown:2,showpreviewroi:3,side:[3,4,20],sigma_g:14,signal0:15,signal:[2,3,4,5,7,12,14,15,18,20],signatur:2,similar:[2,7,20],simpl:18,sinc:18,singl:[2,3,18],singlecolor:18,singular:[14,18,22],size:[4,7,18,20],skip:22,slide:2,slider:[3,18],sliderpress:3,sliderreleas:3,slope:18,slot:3,slowest:2,slowli:2,small:[2,8,22,23],smooth:[2,4,14,18],smoother:18,smoothness_param:[4,14,15,18],softwar:[15,22,23,25],solid:[2,18],some:[7,18],soon:3,sort:[22,23],sourc:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,25],space:[7,14],spatial:[2,7,9,12,14,18,22],spec:[22,23],special:22,special_nist_bcars1_sample_scan:10,special_nist_bcars2:10,specialdemosaicrgb:3,specialestcalibration1:3,specif:[3,4,10,22,25],specifi:[10,12,14,18],spect:2,spect_al:18,spectra:[3,4,5,8,11,14,16,18,22,26],spectral:[2,4,5,7,14,18,22],spectromet:2,spectrosc:2,spectroscopi:[2,3,4,5,14,18,22],spectrum:[2,3,4,5,8,10,11,14,16,18,20,26],spectrumcolorimg:3,speed:2,speedier:2,spetcrum:7,sphinx:[22,23],spinbox:18,spinboxchang:18,spinboxinequalitychang:3,spinboxminmaxset:18,sponaten:[4,5],sqrt:[4,18],squar:[2,4,5,14,16,18],squash:[22,23],stabil:[14,15,22],stabilit:2,standard:[2,3,7,15,18,22,25,26],star:18,starck:[14,15],start:[2,7,14,18,20],startnum:18,state:[14,18,20,22,25],statutori:22,std:[2,7,18],std_nd_to_1d:20,stddev:18,step:[2,7,18,20,23],stepbi:18,stitch:18,stoke:[2,3,4,5,14,18,22],stop:[2,7,20],str:[3,7,10,12,14,18,20],string:[7,18],structur:2,sub:[2,4,10,18],sub_asym_list:18,sub_w_list:18,subclass:[10,14,20],subdark:3,subject:[22,25],submain:18,submit:18,submodul:26,subnrb:18,subpackag:26,subract:2,subrang:18,subresidu:3,subsampl:[2,9],subsect:18,subtract:[3,7,12,13,14,18,22],subtract_baselin:[3,26],subtract_dark:[3,26],subtract_mean:[3,26],subtractbaselin:14,subtractdark:14,subtractmeanoverrang:14,subtractroistart:3,subui:18,subuisvd:18,success:[3,10,14],suffix:18,sum:[2,18],summat:[12,13],sun:18,superced:18,support:18,suppress:12,supress:12,sure:7,sustain:22,svd:[3,14,18,22],svddecompos:14,svdrecompos:14,svs:14,system:[2,4,10,18,22,23],tab:[2,3],tabl:[5,23],tabmainchang:3,take:[2,4,5,7,12,20],tamper:15,task:2,tear:[8,11,13,16],technolog:[15,22,25],term:[4,18],termin:18,test2:27,test:[3,4,7,10,12,14,20,22,23,27],test_2d_uniform_obj:8,test_2dbasic_redux_rng:16,test_2dbasic_transform_redux_rng:16,test_3d_crop_transpose_flip:8,test_3d_crop_transpose_flips_2:8,test_3d_uniform_obj:8,test_add:13,test_al:[3,14],test_anscomb:[3,14],test_bas:[6,16],test_baseline_sub:[3,14],test_basic2d:6,test_basic3d:6,test_basic_redux:16,test_basic_redux_rng:16,test_basic_rng:16,test_basic_transform:6,test_big_to_small_2d:8,test_big_to_small_2d_2:8,test_big_to_small_3d:8,test_big_to_small_3d_2:8,test_big_to_small_3d_output_given:8,test_big_to_small_3d_output_given_crop:8,test_big_to_small_3d_output_given_crop_transpose_flip:8,test_blank:8,test_breadcrumb:[3,20],test_breadcrumb_offset:21,test_calc_ansc_param:16,test_crop:[3,14],test_crop_2d:8,test_crop_3d:8,test_cut_every_n_spectra:16,test_data_index:[3,7],test_divid:13,test_err_wrong_dim:8,test_err_wrong_dim_append:8,test_fix_end:[6,16],test_fix_rng:[6,16],test_gener:[3,20],test_hdf2:8,test_hdf5:[3,10],test_hdf_import_hsi_to_hsi:11,test_hdf_import_no_output_cls_given:11,test_hdf_import_spectra_to_spectra:11,test_hdf_import_spectrum_to_spectrum:11,test_hilbert:[3,4],test_hilbert_in_plac:6,test_hilbert_no_pad:6,test_hilbert_pad:6,test_hilbert_replace_min_valu:6,test_hsi:[3,7],test_hsi_to_hsi:8,test_hsi_to_hsi_rng:8,test_hsi_to_spectra:8,test_hsi_to_spectra_rng:8,test_hsi_to_spectrum:8,test_hsi_to_spectrum_rng:8,test_kk:[3,4],test_kk_3d:6,test_kk_alg:[3,4],test_kk_conjug:6,test_kk_no_bg_norm:6,test_kk_properties_read:6,test_kk_properties_sett:6,test_kk_rng:6,test_kk_transform:6,test_kk_transform_fail:6,test_max:13,test_max_unord:13,test_maxab:13,test_mean_axes_stat:8,test_measur:[3,12],test_measurements_complex:[3,12],test_merge_nrb:[3,4],test_min:13,test_min_unord:13,test_minab:13,test_mosa:[3,7],test_mosaic_hdf:[3,7],test_multipli:13,test_pad_1d:21,test_pad_1d_0_width:21,test_pad_2d:21,test_pad_2d_0_width:21,test_pad_dual_1d:21,test_pad_dual_1d_all_0:21,test_pad_dual_2d:21,test_pad_edge_mean:[3,20],test_pbt:13,test_peak:13,test_peakfind:[3,12],test_pec:[3,4],test_reshape_axes_stat:8,test_rng:6,test_rng_redux2d:6,test_rng_redux3d:6,test_rng_redux:6,test_rng_redux_fix_rng:16,test_rng_redux_fix_rng_vecasym:16,test_sec:[3,4],test_spectra:[3,7],test_spectra_to_hsi:8,test_spectra_to_hsi_rng:8,test_spectra_to_spectra:8,test_spectra_to_spectra_rng:8,test_spectra_to_spectrum:8,test_spectra_to_spectrum_rng:8,test_spectrum:[3,7],test_spectrum_to_hsi:8,test_spectrum_to_hsi_rng:8,test_spectrum_to_spectra:8,test_spectrum_to_spectra_rng:8,test_spectrum_to_spectrum:8,test_spectrum_to_spectrum_rng:8,test_sub_hsi_from_hsi:16,test_sub_hsi_from_spectra:16,test_sub_hsi_from_spectrum:16,test_sub_hsi_int_from_hsi_float:16,test_sub_spectra_from_hsi:16,test_sub_spectra_from_spectra:16,test_sub_spectra_from_spectrum:16,test_sub_spectrum_from_hsi:16,test_sub_spectrum_from_spectra:16,test_sub_spectrum_from_spectrum:16,test_subtract:13,test_subtract_dark:[3,14],test_sum:13,test_sum_abs_re_im:13,test_sum_re_im:13,test_sum_unord:13,test_transform_incompatible_dtyp:16,test_transform_rng:6,test_vec_asym_param:16,test_vec_asym_param_rng_redux:16,test_zero_col_first_col:16,test_zero_col_last_col:16,test_zero_row_first_row:16,test_zero_row_last_row:16,text:18,textfromvalu:18,than:[2,3,4,10,18],thei:7,them:22,thi:[1,2,3,4,5,7,8,14,15,18,20,22,23,25],thin:18,thing:[2,7,12,22],tho:3,those:[1,2,7,18],though:2,three:[2,5],through:[2,3],thru:22,thu:[2,10,14,18,22,23],time:[2,4,5,14,18],tip:[14,15],tissu:2,titl:[18,22,25],to_find:20,to_open:18,todo:7,tool:[2,3,18,22],toolbar:3,toolbarset:3,toolbarsetup:3,toolkit:26,tort:22,total:[2,7],tr1:12,tr2:12,track:3,tradit:2,tran:[2,14,15],transfer:25,transform:[3,4,5,6,13,14,15,16,18,22,26],translat:15,transpos:[8,14],transpose_arr:18,treat:12,trend:2,triangl:18,trough:[2,12,13,18],tue:[7,14],tune:2,tupl:[7,18,20],tut:15,tutori:2,tuusula:15,two:[4,5,12],type:[4,5,7,10,12,14,15,18,20],typeerror:16,typic:2,ui_chang:18,unbias:[2,14,15],uncalibr:18,uncheck:2,under:[2,23],undo:[3,20],unexpect:22,unfortun:2,uniform:[2,7],uninstal:[22,23],uniqu:20,unit:[3,7,18,19,22,25],uniti:15,unitshap:7,unitshape_orig:7,univers:[14,15],unless:23,unlik:2,unpublish:2,unselect:18,unselected_factor:18,until:[20,22,23],unusu:2,updat:[3,7,18],update_calib_from_data:7,update_data_from_calib:7,updatecurrentremaind:18,updatedataset:18,updatefrequ:18,updatehistori:3,updateinputvalu:18,updatemosaicimag:18,updateoutputvalu:18,updateoverlai:3,updateparam:18,updateplot:18,updateslid:18,upon:22,upper:2,usabl:7,usag:26,use:[2,10,12,14,22,23,25],use_imag:[14,18],use_prev:15,used:[2,7,16,20,25],useful:7,user:[1,2,3,22],uses:[2,22],using:[2,4,5,12,14,15,18,22],util:[2,3,12,18,22,26],uva:2,val1:20,val2:20,valid:18,valid_float_str:18,valu:[3,4,5,7,10,12,14,18,20,22],valuefromtext:18,vandenabeel:2,var1:20,var2:20,vari:2,variabl:[7,18,20],variabledict:18,varianc:[14,15,22],vec:7,vector:[2,7,9,18,19,20],verbos:[4,12,15,18],veri:[7,18],version:[2,18,19,20,22,23],vert:[18,20],vertex:[2,3],vertic:[2,19,20],verts_to_path:20,verts_to_points_in_roi:20,via:[4,5,18,22],view:[3,18,22],visgentuil:18,visibl:2,visual:[3,22],vol:15,volum:2,volumetr:2,wai:[3,22,23],walk:22,walker:2,warranti:22,water:2,wavelength:[2,7],wavelet:12,wavenumb:[2,3,4,5,7,18],wavenumber_increas:[4,18],web:23,wed:[4,10,18,20],weight:[4,14,18],weight_sub_val_chang:18,weighted_mean_alpha:14,weightspinboxchang:18,well:3,were:[18,20,25],what:[2,7],whatsoev:25,when:[2,7,11,16,21],where:[7,12,15,18],wherein:2,whether:[7,10,14,22],which:[2,5,7,14,20],whichev:18,white:2,whittak:18,widget:3,widget_:[3,26],widget_arpl:[3,26],widget_calibr:[3,26],widget_chang:18,widget_cut_every_n_spectra:[3,26],widget_detrend:[3,26],widget_imag:[3,26],widget_jupyt:[3,26],widget_kk:[3,26],widget_mergenrb:[3,26],widget_scientificspin:[3,26],widget_sg:[3,26],widgetarpl:18,widgetbwimg:18,widgetcalibr:18,widgetcolormath:18,widgetcolormod:18,widgetcompositecolor:18,widgetcuteverynspectra:18,widgetdemoploteffectplugin:18,widgetdetrend:18,widgetgrayscaleinfobar:18,widgetimagegainmath:18,widgetkk:18,widgetmergenrb:18,widgetoptionschang:18,widgetpopspectrumg:18,widgetsg:18,widgetsglcolor:18,width:[2,12,18],win_siz:4,window:[2,3,18,20],window_length:18,winext:18,winpython:[22,23],wish:22,within:[2,7,18,20,22,23],without:[8,22,23],wl0:7,wl_vec:7,wn_switchpt:18,wn_vec:[7,18],wnchang:18,won:23,work:[20,22,23],workflow:22,workshop:15,would:[2,7],wrap:14,wrapper:20,write:5,written:[7,20],wrong:13,wv_width:12,www:[2,15,22,23],x_label:[3,18,27],x_pix:7,x_rep:7,x_unit:[3,27],xlen:18,xpix:18,xunit:18,xvec:[19,20],y_label:[3,18,27],y_pad:20,y_pix:7,y_rep:7,y_unit:[3,27],yellow:[2,18],yet:7,ylen:18,you:[2,4,5,22,23],your:[2,4,5,22,23],ypix:18,yunit:18,yvec:[19,20],zanran_storag:2,zero:[3,14,20],zero_col:14,zero_row:14,zerocolumn:14,zerofirstcolumn:3,zerofirstrow:3,zerolastcolumn:3,zerolastrow:3,zerorow:14,zoom:[2,7]},titles:["Command Line Tools & Algorithms","API Reference","Walk-Thru: CRI Processing","crikit package","crikit.cri package","crikit.cri.algorithms package","crikit.cri.tests package","crikit.data package","crikit.data.tests package","crikit.datasets package","crikit.io package","crikit.io.tests package","crikit.measurement package","crikit.measurement.tests package","crikit.preprocess package","crikit.preprocess.algorithms package","crikit.preprocess.tests package","crikit.transform package","crikit.ui package","crikit.ui.utils package","crikit.utils package","crikit.utils.tests package","CRIKit2: Hyperspectral imaging toolkit","Installation Information","Input/Output (IO) Interfaces for CRIkit2","License","CRIkit2","Running the CRIkit2 Graphical User Interface"],titleterms:{"class":[1,18,20],"function":1,"import":[22,23],"static":[22,23],For:[22,23],The:2,abstract_:15,action:2,algorithm:[0,5,15],als:15,anscomb:[2,15],api:1,arpl:15,author:3,avail:[22,23],bcar:2,breadcrumb:20,build:[22,23],built:2,calibr:2,check_requir:19,citat:22,classes_ui:18,clone:23,coher:1,color:2,command:0,contact:22,contain:1,content:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],copi:[22,23],correct:2,cri:[1,2,4,5,6,19],crikit2:[3,22,23,24,26,27],crikit:[1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],crikitui:3,crop:14,csv_nist:10,dark:2,data:[1,7,8],datacheck:20,dataset:[2,9],decomposit:2,denois:[2,14],depend:[22,23],dialog:18,dialog_abstractfactor:18,dialog_abstractploteffect:18,dialog_anscombeparam:18,dialog_kkopt:18,dialog_model:18,dialog_ploteffect:18,dialog_sav:18,dialog_subresidualopt:18,dialog_svd:18,dialog_varstabanscombeopt:18,document:[22,23],dynam:[22,23],easili:22,error:2,error_correct:4,factor:7,fftspatialnois:12,file:2,frequenc:7,from:[2,27],gener:[2,19,20],git:22,graphic:27,hdf5:10,hdf:2,helper_plotopt:18,helper_roiselect:18,high:[22,23],hsi:[2,7],hyperspectr:[3,22],imag:[3,22],imageri:[1,2],indic:22,inform:23,input:[1,24],instal:[22,23],interest:2,interfac:[18,24,27],invers:2,ipython:27,issu:[22,23],jupyt:27,known:[22,23],kramer:[2,5],kronig:[2,5],licens:[22,25],line:0,load:2,macro:10,main_mosa:18,math:5,measur:[1,12,13],merg:2,merge_nrb:4,meta_config:10,meta_process:10,method:20,model:9,modul:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,27],monitor:[22,23],mosaic:7,normal:2,nrb:2,nuanc:22,numer:2,oper:22,option:[2,22,23],output:[1,24],overview:2,packag:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],peakamp:12,peakfind:12,phantom:2,phase:[2,5],pip:[22,23],preprocess:[1,14,15,16],process:[2,5,19],pseudo:2,pyqt:[22,23],python:[22,23,27],raman:[1,2],refer:[1,2],region:2,relat:[2,5],replic:7,residu:2,resolut:[22,23],retriev:[2,5],roi:[2,19,20],run:27,save:[2,18],scale:2,shell:27,singular:2,skip:2,spectra:[2,7],spectral:19,spectrum:7,stabil:2,standard:14,start:22,submodul:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21],subpackag:[3,4,7,10,12,14,18,20],subtract:2,subtract_baselin:14,subtract_dark:14,subtract_mean:14,svd:2,tabl:22,test:[6,8,11,13,16,21],test_al:16,test_anscomb:16,test_baseline_sub:16,test_breadcrumb:21,test_crop:16,test_data_index:8,test_gener:21,test_hdf5:11,test_hilbert:6,test_hsi:8,test_kk:6,test_kk_alg:6,test_measur:13,test_measurements_complex:13,test_merge_nrb:6,test_mosa:8,test_mosaic_hdf:8,test_pad_edge_mean:21,test_peakfind:13,test_pec:6,test_sec:6,test_spectra:8,test_spectrum:8,test_subtract_dark:16,through:[22,23],thru:2,tool:[0,19],toolkit:[3,22],transform:[2,17],two:2,updat:[22,23],usag:3,user:[18,27],util:[1,19,20,21],valu:2,varianc:2,via:[2,23],view:2,visgentuil:19,visual:[18,19],walk:2,widget:18,widget_:18,widget_arpl:18,widget_calibr:18,widget_cut_every_n_spectra:18,widget_detrend:18,widget_imag:18,widget_jupyt:18,widget_kk:18,widget_mergenrb:18,widget_scientificspin:18,widget_sg:18,window:[22,23],within:27,workflow:2}}) \ No newline at end of file +Search.setIndex({docnames:["algorithms","api","cri_walkthru","crikit","crikit.cri","crikit.cri.algorithms","crikit.cri.tests","crikit.data","crikit.data.tests","crikit.datasets","crikit.io","crikit.io.lazy5","crikit.io.lazy5.tests","crikit.io.lazy5.ui","crikit.io.tests","crikit.measurement","crikit.measurement.tests","crikit.preprocess","crikit.preprocess.algorithms","crikit.preprocess.tests","crikit.transform","crikit.ui","crikit.ui.utils","crikit.utils","crikit.utils.tests","index","installing","io","license","modules","running"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["algorithms.rst","api.rst","cri_walkthru.rst","crikit.rst","crikit.cri.rst","crikit.cri.algorithms.rst","crikit.cri.tests.rst","crikit.data.rst","crikit.data.tests.rst","crikit.datasets.rst","crikit.io.rst","crikit.io.lazy5.rst","crikit.io.lazy5.tests.rst","crikit.io.lazy5.ui.rst","crikit.io.tests.rst","crikit.measurement.rst","crikit.measurement.tests.rst","crikit.preprocess.rst","crikit.preprocess.algorithms.rst","crikit.preprocess.tests.rst","crikit.transform.rst","crikit.ui.rst","crikit.ui.utils.rst","crikit.utils.rst","crikit.utils.tests.rst","index.rst","installing.rst","io.rst","license.rst","modules.rst","running.rst"],objects:{"":[[3,0,0,"-","crikit"]],"crikit.CRIkitUI":[[3,1,1,"","CRIkitUI_process"],[3,4,1,"","crikit_launch"]],"crikit.CRIkitUI.CRIkitUI_process":[[3,2,1,"","NUMCOLORS"],[3,3,1,"","anscombe"],[3,3,1,"","calcAnscombeParams"],[3,3,1,"","calibrate"],[3,3,1,"","calibrationReset"],[3,3,1,"","changeSlider"],[3,3,1,"","checkCompositeUpdate"],[3,3,1,"","checkShowOverlays"],[3,3,1,"","closeEvent"],[3,3,1,"","condInEqualityChange"],[3,3,1,"","condOpChange"],[3,3,1,"","createImgBW"],[3,3,1,"","cutEveryNSpectra"],[3,3,1,"","deNoise"],[3,3,1,"","deNoiseDark"],[3,3,1,"","deNoiseNRB"],[3,3,1,"","deleteOverlays"],[3,3,1,"","delete_preview_rois"],[3,3,1,"","doComposite"],[3,3,1,"","doKK"],[3,3,1,"","doMath"],[3,3,1,"","doUndo"],[3,3,1,"","errorCorrectAmp"],[3,3,1,"","errorCorrectPhase"],[3,3,1,"","errorCorrectScale"],[3,3,1,"","fileOpenDLMNIST"],[3,3,1,"","fileOpenHDFMacroRasterNIST"],[3,3,1,"","fileOpenHDFNIST"],[3,3,1,"","fileOpenHDFNISTOOC"],[3,3,1,"","fileOpenSuccess"],[3,3,1,"","freqWindow"],[3,3,1,"","get_preview_spectra"],[3,3,1,"","inverseAnscombe"],[3,3,1,"","lineEditFreqChanged"],[3,3,1,"","lineEditPixChanged"],[3,3,1,"","loadDark"],[3,3,1,"","loadDarkDLM"],[3,3,1,"","loadNRB"],[3,3,1,"","loadNRBDLM"],[3,3,1,"","makeBCARSPhantom"],[3,3,1,"","makeRamanPhantom"],[3,3,1,"","mergeNRBs"],[3,3,1,"","mosaicTool"],[3,3,1,"","nrbFromROI"],[3,3,1,"","opChange"],[3,3,1,"","plotDarkSpectrum"],[3,3,1,"","plotLeftNRBSpectrum"],[3,3,1,"","plotNRBSpectrum"],[3,3,1,"","plotRightNRBSpectrum"],[3,3,1,"","plotter_show"],[3,3,1,"","pointSpectrum"],[3,3,1,"","roiSpectrum"],[3,3,1,"","save"],[3,3,1,"","setCondFreq1"],[3,3,1,"","setCondFreq2"],[3,3,1,"","setCondFreq3"],[3,3,1,"","setOpFreq1"],[3,3,1,"","setOpFreq2"],[3,3,1,"","setOpFreq3"],[3,3,1,"","set_preview_rois"],[3,3,1,"","settings"],[3,3,1,"","showPreviewRois"],[3,3,1,"","sliderPressed"],[3,3,1,"","sliderReleased"],[3,3,1,"","specialDemosaicRGB"],[3,3,1,"","specialEstCalibration1"],[3,3,1,"","spectrumColorImg"],[3,3,1,"","spinBoxInEqualityChange"],[3,3,1,"","subDark"],[3,3,1,"","subResidual"],[3,3,1,"","subtractROIStart"],[3,3,1,"","tabMainChange"],[3,3,1,"","toolbarSetting"],[3,3,1,"","toolbarSetup"],[3,3,1,"","updateHistory"],[3,3,1,"","updateOverlays"],[3,3,1,"","zeroFirstColumn"],[3,3,1,"","zeroFirstRow"],[3,3,1,"","zeroLastColumn"],[3,3,1,"","zeroLastRow"]],"crikit.cri":[[5,0,0,"-","algorithms"],[4,0,0,"-","error_correction"],[4,0,0,"-","kk"],[4,0,0,"-","merge_nrbs"],[6,0,0,"-","tests"]],"crikit.cri.algorithms":[[5,0,0,"-","kk"]],"crikit.cri.algorithms.kk":[[5,4,1,"","hilbertfft"],[5,4,1,"","kkrelation"]],"crikit.cri.error_correction":[[4,1,1,"","PhaseErrCorrectALS"],[4,1,1,"","ScaleErrCorrectSG"]],"crikit.cri.error_correction.PhaseErrCorrectALS":[[4,3,1,"","calculate"],[4,3,1,"","transform"]],"crikit.cri.error_correction.ScaleErrCorrectSG":[[4,3,1,"","calculate"],[4,3,1,"","transform"]],"crikit.cri.kk":[[4,1,1,"","KramersKronig"]],"crikit.cri.kk.KramersKronig":[[4,3,1,"","calculate"],[4,5,1,"","norm_to_nrb"],[4,5,1,"","pad_factor"],[4,5,1,"","phase_offset"]],"crikit.cri.merge_nrbs":[[4,1,1,"","MergeNRBs"]],"crikit.cri.merge_nrbs.MergeNRBs":[[4,3,1,"","calculate"]],"crikit.cri.tests":[[6,0,0,"-","test_hilbert"],[6,0,0,"-","test_kk"],[6,0,0,"-","test_kk_alg"],[6,0,0,"-","test_merge_nrbs"],[6,0,0,"-","test_pec"],[6,0,0,"-","test_sec"]],"crikit.cri.tests.test_hilbert":[[6,4,1,"","test_hilbert_in_place"],[6,4,1,"","test_hilbert_no_pad"],[6,4,1,"","test_hilbert_pad"],[6,4,1,"","test_hilbert_replace_min_value"]],"crikit.cri.tests.test_kk":[[6,4,1,"","test_kk"],[6,4,1,"","test_kk_no_bg_norm"],[6,4,1,"","test_kk_properties_read"],[6,4,1,"","test_kk_properties_setter"],[6,4,1,"","test_kk_rng"],[6,4,1,"","test_kk_transform"],[6,4,1,"","test_kk_transform_fail"]],"crikit.cri.tests.test_kk_alg":[[6,4,1,"","test_kk"],[6,4,1,"","test_kk_3d"],[6,4,1,"","test_kk_conjugate"],[6,4,1,"","test_kk_no_bg_norm"]],"crikit.cri.tests.test_merge_nrbs":[[6,4,1,"","test_basic"]],"crikit.cri.tests.test_pec":[[6,4,1,"","test_basic"],[6,4,1,"","test_basic2D"],[6,4,1,"","test_basic3D"],[6,4,1,"","test_fix_ends"],[6,4,1,"","test_fix_rng"],[6,4,1,"","test_rng"],[6,4,1,"","test_rng_redux"],[6,4,1,"","test_rng_redux2D"],[6,4,1,"","test_rng_redux3D"],[6,4,1,"","test_transform_rng"]],"crikit.cri.tests.test_sec":[[6,4,1,"","test_basic"],[6,4,1,"","test_basic_transform"],[6,4,1,"","test_rng"]],"crikit.data":[[7,0,0,"-","factorized"],[7,0,0,"-","frequency"],[7,0,0,"-","mosaic"],[7,0,0,"-","replicate"],[7,0,0,"-","spectra"],[8,0,0,"-","tests"]],"crikit.data.factorized":[[7,1,1,"","FactorizedHsi"],[7,1,1,"","FactorizedSpectra"]],"crikit.data.frequency":[[7,1,1,"","Frequency"],[7,4,1,"","calib_pix_wl"],[7,4,1,"","calib_pix_wn"]],"crikit.data.frequency.Frequency":[[7,5,1,"id0","calib"],[7,5,1,"id1","calib_fcn"],[7,5,1,"id2","calib_orig"],[7,5,1,"id3","data"],[7,3,1,"id4","get_closest_freq"],[7,3,1,"id5","get_index_of_closest_freq"],[7,5,1,"id6","op_list_freq"],[7,5,1,"id7","op_list_pix"],[7,5,1,"id8","op_range_freq"],[7,5,1,"","op_range_pix"],[7,5,1,"","op_size"],[7,5,1,"id9","pix_vec"],[7,5,1,"id10","plot_list_freq"],[7,5,1,"id11","plot_list_pix"],[7,2,1,"","plot_range_freq"],[7,5,1,"id12","size"],[7,5,1,"id13","units"],[7,3,1,"id14","update"]],"crikit.data.mosaic":[[7,1,1,"","Mosaic"]],"crikit.data.mosaic.Mosaic":[[7,3,1,"","append"],[7,3,1,"","attr_dict"],[7,5,1,"","dtype"],[7,5,1,"","is2d"],[7,5,1,"","is3d"],[7,5,1,"","issamedim"],[7,3,1,"","mosaic2d"],[7,3,1,"","mosaic_mask"],[7,3,1,"","mosaic_shape"],[7,3,1,"","mosaicfull"],[7,5,1,"","shape"],[7,5,1,"","size"],[7,5,1,"","unitshape"],[7,5,1,"","unitshape_orig"]],"crikit.data.replicate":[[7,1,1,"","Replicate"]],"crikit.data.replicate.Replicate":[[7,5,1,"id15","calib"],[7,3,1,"id16","calib_data_agree"],[7,5,1,"id17","data"],[7,5,1,"","label"],[7,5,1,"id18","size"],[7,5,1,"id19","units"],[7,3,1,"id20","update_calib_from_data"],[7,3,1,"id21","update_data_from_calib"]],"crikit.data.spectra":[[7,1,1,"","Hsi"],[7,1,1,"","Spectra"],[7,1,1,"","Spectrum"]],"crikit.data.spectra.Hsi":[[7,3,1,"","check"],[7,2,1,"","config"],[7,5,1,"","data"],[7,5,1,"id22","extent"],[7,3,1,"","get_rand_spectra"],[7,5,1,"","mask"],[7,2,1,"","shape"],[7,2,1,"","size"],[7,3,1,"","subtract"],[7,5,1,"","x"],[7,5,1,"","x_rep"],[7,5,1,"","y"],[7,5,1,"","y_rep"]],"crikit.data.spectra.Spectra":[[7,2,1,"","config"],[7,5,1,"id23","data"],[7,2,1,"","freq"],[7,2,1,"","label"],[7,2,1,"","meta"],[7,5,1,"id24","n_pix"],[7,5,1,"id25","reps"],[7,2,1,"","shape"],[7,3,1,"","subtract"],[7,2,1,"","units"]],"crikit.data.spectra.Spectrum":[[7,2,1,"","config"],[7,5,1,"id26","data"],[7,5,1,"","f"],[7,5,1,"","f_full"],[7,5,1,"id27","f_pix"],[7,5,1,"id28","freq"],[7,5,1,"id29","label"],[7,3,1,"","mean"],[7,5,1,"id30","meta"],[7,5,1,"id31","ndim"],[7,5,1,"id32","shape"],[7,5,1,"id33","size"],[7,3,1,"","std"],[7,3,1,"","subtract"],[7,5,1,"id34","units"]],"crikit.data.tests":[[8,0,0,"-","test_hsi"],[8,0,0,"-","test_mosaic"],[8,0,0,"-","test_mosaic_hdf"],[8,0,0,"-","test_spectra"],[8,0,0,"-","test_spectrum"]],"crikit.data.tests.test_hsi":[[8,4,1,"","make_datasets"],[8,4,1,"","test_hsi_to_hsi"],[8,4,1,"","test_hsi_to_hsi_rng"],[8,4,1,"","test_mean_axes_static"],[8,4,1,"","test_reshape_axes_static"],[8,4,1,"","test_spectra_to_hsi"],[8,4,1,"","test_spectra_to_hsi_rng"],[8,4,1,"","test_spectrum_to_hsi"],[8,4,1,"","test_spectrum_to_hsi_rng"]],"crikit.data.tests.test_mosaic":[[8,4,1,"","test_2D_uniform_obj"],[8,4,1,"","test_3D_crop_transpose_flips"],[8,4,1,"","test_3D_crop_transpose_flips_2"],[8,4,1,"","test_3D_uniform_obj"],[8,4,1,"","test_big_to_small_2d"],[8,4,1,"","test_big_to_small_2d_2"],[8,4,1,"","test_big_to_small_3d"],[8,4,1,"","test_big_to_small_3d_2"],[8,4,1,"","test_big_to_small_3d_output_given"],[8,4,1,"","test_blank"],[8,4,1,"","test_crop_2D"],[8,4,1,"","test_crop_3D"],[8,4,1,"","test_err_wrong_dim"],[8,4,1,"","test_err_wrong_dim_append"]],"crikit.data.tests.test_mosaic_hdf":[[8,4,1,"","hdf_dataset2"],[8,4,1,"","test_big_to_small_3d_output_given"],[8,4,1,"","test_big_to_small_3d_output_given_crop"],[8,4,1,"","test_big_to_small_3d_output_given_crop_transpose_flips"],[8,4,1,"","test_hdf2"]],"crikit.data.tests.test_spectra":[[8,4,1,"","make_datasets"],[8,4,1,"","test_hsi_to_spectra"],[8,4,1,"","test_hsi_to_spectra_rng"],[8,4,1,"","test_mean_axes_static"],[8,4,1,"","test_reshape_axes_static"],[8,4,1,"","test_spectra_to_spectra"],[8,4,1,"","test_spectra_to_spectra_rng"],[8,4,1,"","test_spectrum_to_spectra"],[8,4,1,"","test_spectrum_to_spectra_rng"]],"crikit.data.tests.test_spectrum":[[8,4,1,"","make_datasets"],[8,4,1,"","test_hsi_to_spectrum"],[8,4,1,"","test_hsi_to_spectrum_rng"],[8,4,1,"","test_mean_axes_static"],[8,4,1,"","test_spectra_to_spectrum"],[8,4,1,"","test_spectra_to_spectrum_rng"],[8,4,1,"","test_spectrum_to_spectrum"],[8,4,1,"","test_spectrum_to_spectrum_rng"]],"crikit.datasets":[[9,0,0,"-","model"]],"crikit.datasets.model":[[9,1,1,"","Model"]],"crikit.datasets.model.Model":[[9,5,1,"","f"],[9,5,1,"","hsi_i"],[9,5,1,"","hsi_r"],[9,3,1,"","make_hsi"],[9,3,1,"","make_spectra"],[9,5,1,"","wn"]],"crikit.io":[[10,0,0,"-","csv_nist"],[10,0,0,"-","hdf5"],[11,0,0,"-","lazy5"],[10,0,0,"-","macros"],[10,0,0,"-","meta_configs"],[10,0,0,"-","meta_process"],[14,0,0,"-","tests"]],"crikit.io.csv_nist":[[10,4,1,"","csv_nist_import_data"]],"crikit.io.hdf5":[[10,4,1,"","hdf_import_data"],[10,4,1,"","hdf_import_data_macroraster"]],"crikit.io.lazy5":[[11,0,0,"-","alter"],[11,0,0,"-","config"],[11,0,0,"-","create"],[11,0,0,"-","inspect"],[11,0,0,"-","nonh5utils"],[12,0,0,"-","tests"],[13,0,0,"-","ui"],[11,0,0,"-","utils"]],"crikit.io.lazy5.alter":[[11,4,1,"","alter_attr"],[11,4,1,"","alter_attr_same"],[11,4,1,"","write_attr_dict"]],"crikit.io.lazy5.config":[[11,1,1,"","DefaultConfig"]],"crikit.io.lazy5.create":[[11,4,1,"","save"]],"crikit.io.lazy5.inspect":[[11,4,1,"","get_attrs_dset"],[11,4,1,"","get_datasets"],[11,4,1,"","get_groups"],[11,4,1,"","get_hierarchy"],[11,4,1,"","valid_dsets"],[11,4,1,"","valid_file"]],"crikit.io.lazy5.nonh5utils":[[11,4,1,"","check_type_compat"],[11,4,1,"","filterlist"],[11,4,1,"","return_family_type"]],"crikit.io.lazy5.tests":[[12,0,0,"-","test_alter"],[12,0,0,"-","test_create"],[12,0,0,"-","test_inspect"],[12,0,0,"-","test_nonh5utils"],[12,0,0,"-","test_ui"],[12,0,0,"-","test_utils"]],"crikit.io.lazy5.tests.test_alter":[[12,4,1,"","hdf_dataset"],[12,4,1,"","test_attr_alter"],[12,4,1,"","test_attr_alter_same"],[12,4,1,"","test_write_attr_dict"]],"crikit.io.lazy5.tests.test_create":[[12,4,1,"","test_save_diff_path"],[12,4,1,"","test_save_no_attrs"],[12,4,1,"","test_save_to_open_h5_file"],[12,4,1,"","test_save_to_open_wrong_type"]],"crikit.io.lazy5.tests.test_inspect":[[12,4,1,"","hdf_dataset"],[12,4,1,"","test_get_datasets_fullpath"],[12,4,1,"","test_get_datasets_nopath"],[12,4,1,"","test_get_dset_attrs"],[12,4,1,"","test_get_groups"],[12,4,1,"","test_get_hierarchy_fullpath"],[12,4,1,"","test_get_hierarchy_grp_w_dset"],[12,4,1,"","test_get_hierarchy_nopath"],[12,4,1,"","test_valid_dsets"],[12,4,1,"","test_valid_file"]],"crikit.io.lazy5.tests.test_nonh5utils":[[12,4,1,"","test_check_type_compat"],[12,4,1,"","test_filter_list"],[12,4,1,"","test_return_family_type"]],"crikit.io.lazy5.tests.test_ui":[[12,1,1,"","TestUI"]],"crikit.io.lazy5.tests.test_ui.TestUI":[[12,3,1,"","hdf_dataset"],[12,2,1,"","pytestmark"],[12,3,1,"","test_ui_attrs"],[12,3,1,"","test_ui_change_grp_and_filter_exclude"],[12,3,1,"","test_ui_change_grp_and_filter_include"],[12,3,1,"","test_ui_load_file"],[12,3,1,"","test_ui_win_title_empty_load_dataset"],[12,3,1,"","test_ui_win_title_load_dataset"],[12,3,1,"","test_ui_wrongfile"]],"crikit.io.lazy5.tests.test_utils":[[12,4,1,"","hdf_dataset"],[12,4,1,"","test_fid_or_file_close_if_not_fid"],[12,4,1,"","test_fid_or_file_fid_provided"],[12,4,1,"","test_fid_or_file_filename_provided"],[12,4,1,"","test_fullpath"],[12,4,1,"","test_hdf_is_open"]],"crikit.io.lazy5.ui":[[13,0,0,"-","QtHdfLoad"],[13,0,0,"-","qt_HdfLoad"]],"crikit.io.lazy5.ui.QtHdfLoad":[[13,1,1,"","HdfLoad"]],"crikit.io.lazy5.ui.QtHdfLoad.HdfLoad":[[13,2,1,"","config"],[13,3,1,"","dataGroupChange"],[13,3,1,"","datasetSelected"],[13,3,1,"","fileOpen"],[13,3,1,"","filterDatasets"],[13,3,1,"","getFileDataSets"],[13,3,1,"","populateGroups"],[13,3,1,"","populate_attrs"]],"crikit.io.lazy5.ui.qt_HdfLoad":[[13,1,1,"","Ui_Dialog"]],"crikit.io.lazy5.ui.qt_HdfLoad.Ui_Dialog":[[13,3,1,"","retranslateUi"],[13,3,1,"","setupUi"]],"crikit.io.lazy5.utils":[[11,1,1,"","FidOrFile"],[11,4,1,"","fullpath"],[11,4,1,"","hdf_is_open"]],"crikit.io.lazy5.utils.FidOrFile":[[11,3,1,"","close_if_file_not_fid"],[11,2,1,"","fid"],[11,2,1,"","is_fid"],[11,3,1,"","return_fid_from_file"]],"crikit.io.macros":[[10,4,1,"","import_csv_nist_special1"],[10,4,1,"","import_hdf_nist_special"]],"crikit.io.meta_configs":[[10,4,1,"","special_nist_bcars1_sample_scan"],[10,4,1,"","special_nist_bcars2"]],"crikit.io.meta_process":[[10,4,1,"","meta_process"],[10,4,1,"","rosetta_query"]],"crikit.io.tests":[[14,0,0,"-","test_hdf5"]],"crikit.io.tests.test_hdf5":[[14,4,1,"","hdf_dataset"],[14,4,1,"","test_hdf_import_hsi_to_hsi"],[14,4,1,"","test_hdf_import_no_output_cls_given"],[14,4,1,"","test_hdf_import_spectra_to_spectra"],[14,4,1,"","test_hdf_import_spectrum_to_spectrum"]],"crikit.measurement":[[15,0,0,"-","fftspatialnoise"],[15,0,0,"-","peakamps"],[15,0,0,"-","peakfind"],[16,0,0,"-","tests"]],"crikit.measurement.fftspatialnoise":[[15,1,1,"","FFTSignalMetric"]],"crikit.measurement.fftspatialnoise.FFTSignalMetric":[[15,3,1,"","calc"]],"crikit.measurement.peakamps":[[15,1,1,"","AbstractMeasureThree"],[15,1,1,"","AbstractMeasureTwo"],[15,1,1,"","AbstractMeasureTwoOrdered"],[15,1,1,"","MeasurePeak"],[15,1,1,"","MeasurePeakAdd"],[15,1,1,"","MeasurePeakBWTroughs"],[15,1,1,"","MeasurePeakDivide"],[15,1,1,"","MeasurePeakMax"],[15,1,1,"","MeasurePeakMaxAbs"],[15,1,1,"","MeasurePeakMin"],[15,1,1,"","MeasurePeakMinAbs"],[15,1,1,"","MeasurePeakMinus"],[15,1,1,"","MeasurePeakMultiply"],[15,1,1,"","MeasurePeakSum"],[15,1,1,"","MeasurePeakSumAbsReImag"]],"crikit.measurement.peakamps.AbstractMeasureThree":[[15,3,1,"","calculate"],[15,3,1,"","measure"]],"crikit.measurement.peakamps.AbstractMeasureTwo":[[15,3,1,"","calculate"],[15,3,1,"","measure"]],"crikit.measurement.peakamps.MeasurePeak":[[15,3,1,"","calculate"],[15,3,1,"","measure"],[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakAdd":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakBWTroughs":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakDivide":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMax":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMaxAbs":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMin":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMinAbs":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMinus":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakMultiply":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakSum":[[15,2,1,"","output"]],"crikit.measurement.peakamps.MeasurePeakSumAbsReImag":[[15,2,1,"","output"]],"crikit.measurement.peakfind":[[15,1,1,"","PeakFinder"]],"crikit.measurement.peakfind.PeakFinder":[[15,2,1,"","amp"],[15,3,1,"","calculate"],[15,3,1,"","cwt_diff"],[15,5,1,"","cwt_width"],[15,3,1,"","haar"],[15,5,1,"","noise_sigma"]],"crikit.measurement.tests":[[16,0,0,"-","test_measurement"],[16,0,0,"-","test_measurements_complex"],[16,0,0,"-","test_peakfind"]],"crikit.measurement.tests.test_measurement":[[16,4,1,"","hsi_dataset"],[16,4,1,"","test_add"],[16,4,1,"","test_divide"],[16,4,1,"","test_max"],[16,4,1,"","test_max_unordered"],[16,4,1,"","test_maxabs"],[16,4,1,"","test_min"],[16,4,1,"","test_min_unordered"],[16,4,1,"","test_minabs"],[16,4,1,"","test_multiply"],[16,4,1,"","test_pbt"],[16,4,1,"","test_peak"],[16,4,1,"","test_subtract"],[16,4,1,"","test_sum"],[16,4,1,"","test_sum_re_im"],[16,4,1,"","test_sum_unordered"]],"crikit.measurement.tests.test_measurements_complex":[[16,4,1,"","hsi_dataset"],[16,4,1,"","test_add"],[16,4,1,"","test_divide"],[16,4,1,"","test_max"],[16,4,1,"","test_max_unordered"],[16,4,1,"","test_maxabs"],[16,4,1,"","test_min"],[16,4,1,"","test_min_unordered"],[16,4,1,"","test_minabs"],[16,4,1,"","test_multiply"],[16,4,1,"","test_pbt"],[16,4,1,"","test_peak"],[16,4,1,"","test_subtract"],[16,4,1,"","test_sum"],[16,4,1,"","test_sum_abs_re_im"],[16,4,1,"","test_sum_unordered"]],"crikit.measurement.tests.test_peakfind":[[16,4,1,"","test_peakfind"]],"crikit.preprocess":[[18,0,0,"-","algorithms"],[17,0,0,"-","crop"],[17,0,0,"-","denoise"],[17,0,0,"-","standardize"],[17,0,0,"-","subtract_baseline"],[17,0,0,"-","subtract_dark"],[17,0,0,"-","subtract_mean"],[19,0,0,"-","tests"]],"crikit.preprocess.algorithms":[[18,0,0,"-","abstract_als"],[18,0,0,"-","als"],[18,0,0,"-","anscombe"],[18,0,0,"-","arpls"]],"crikit.preprocess.algorithms.abstract_als":[[18,1,1,"","AbstractBaseline"]],"crikit.preprocess.algorithms.abstract_als.AbstractBaseline":[[18,3,1,"","calculate"],[18,5,1,"","fix_rng"],[18,3,1,"","setup"]],"crikit.preprocess.algorithms.als":[[18,1,1,"","AlsCvxopt"]],"crikit.preprocess.algorithms.als.AlsCvxopt":[[18,5,1,"","asym_param"]],"crikit.preprocess.algorithms.anscombe":[[18,4,1,"","anscombe_inverse_exact_unbiased"],[18,4,1,"","gen_anscombe_forward"],[18,4,1,"","gen_anscombe_inverse_closed_form"],[18,4,1,"","gen_anscombe_inverse_exact_unbiased"]],"crikit.preprocess.algorithms.arpls":[[18,1,1,"","ArPlsCvxopt"]],"crikit.preprocess.crop":[[17,1,1,"","CutEveryNSpectra"],[17,1,1,"","ZeroColumn"],[17,1,1,"","ZeroRow"]],"crikit.preprocess.crop.CutEveryNSpectra":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.crop.ZeroColumn":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.crop.ZeroRow":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.denoise":[[17,1,1,"","SVDDecompose"],[17,1,1,"","SVDRecompose"]],"crikit.preprocess.denoise.SVDDecompose":[[17,3,1,"","calculate"]],"crikit.preprocess.denoise.SVDRecompose":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.standardize":[[17,1,1,"","Anscombe"],[17,1,1,"","AnscombeInverse"],[17,4,1,"","calc_anscombe_parameters"]],"crikit.preprocess.standardize.Anscombe":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.standardize.AnscombeInverse":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.subtract_baseline":[[17,1,1,"","SubtractBaselineALS"]],"crikit.preprocess.subtract_baseline.SubtractBaselineALS":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.subtract_dark":[[17,1,1,"","SubtractDark"]],"crikit.preprocess.subtract_dark.SubtractDark":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.subtract_mean":[[17,1,1,"","SubtractMeanOverRange"]],"crikit.preprocess.subtract_mean.SubtractMeanOverRange":[[17,3,1,"","calculate"],[17,3,1,"","transform"]],"crikit.preprocess.tests":[[19,0,0,"-","test_als"],[19,0,0,"-","test_anscombe"],[19,0,0,"-","test_baseline_sub"],[19,0,0,"-","test_crop"],[19,0,0,"-","test_subtract_dark"]],"crikit.preprocess.tests.test_als":[[19,4,1,"","test_2Dbasic_redux_rng"],[19,4,1,"","test_basic"],[19,4,1,"","test_basic_redux"],[19,4,1,"","test_basic_redux_rng"],[19,4,1,"","test_basic_rng"],[19,4,1,"","test_fix_ends"],[19,4,1,"","test_fix_rng"],[19,4,1,"","test_rng_redux_fix_rng"],[19,4,1,"","test_rng_redux_fix_rng_vecasym"],[19,4,1,"","test_vec_asym_param"],[19,4,1,"","test_vec_asym_param_rng_redux"]],"crikit.preprocess.tests.test_anscombe":[[19,4,1,"","make_datasets"],[19,4,1,"","test_calc_ansc_params"]],"crikit.preprocess.tests.test_baseline_sub":[[19,4,1,"","test_2Dbasic_redux_rng"],[19,4,1,"","test_2Dbasic_transform_redux_rng"],[19,4,1,"","test_basic"],[19,4,1,"","test_basic_redux"],[19,4,1,"","test_basic_redux_rng"],[19,4,1,"","test_basic_rng"],[19,4,1,"","test_fix_ends"],[19,4,1,"","test_fix_rng"],[19,4,1,"","test_rng_redux_fix_rng"],[19,4,1,"","test_vec_asym_param"],[19,4,1,"","test_vec_asym_param_rng_redux"]],"crikit.preprocess.tests.test_crop":[[19,4,1,"","test_cut_every_n_spectra"],[19,4,1,"","test_zero_col_first_col"],[19,4,1,"","test_zero_col_last_col"],[19,4,1,"","test_zero_row_first_row"],[19,4,1,"","test_zero_row_last_row"]],"crikit.preprocess.tests.test_subtract_dark":[[19,4,1,"","make_datasets"],[19,4,1,"","test_sub_hsi_from_hsi"],[19,4,1,"","test_sub_hsi_from_spectra"],[19,4,1,"","test_sub_hsi_from_spectrum"],[19,4,1,"","test_sub_hsi_int_from_hsi_float"],[19,4,1,"","test_sub_spectra_from_hsi"],[19,4,1,"","test_sub_spectra_from_spectra"],[19,4,1,"","test_sub_spectra_from_spectrum"],[19,4,1,"","test_sub_spectrum_from_hsi"],[19,4,1,"","test_sub_spectrum_from_spectra"],[19,4,1,"","test_sub_spectrum_from_spectrum"],[19,4,1,"","test_transform_incompatible_dtypes"]],"crikit.ui":[[21,0,0,"-","classes_ui"],[21,0,0,"-","dialog_AbstractFactorization"],[21,0,0,"-","dialog_AbstractPlotEffect"],[21,0,0,"-","dialog_AnscombeParams"],[21,0,0,"-","dialog_SVD"],[21,0,0,"-","dialog_kkOptions"],[21,0,0,"-","dialog_model"],[21,0,0,"-","dialog_ploteffect"],[21,0,0,"-","dialog_save"],[21,0,0,"-","dialog_subResidualOptions"],[21,0,0,"-","dialog_varstabAnscombeOptions"],[21,0,0,"-","helper_plotOptions"],[21,0,0,"-","helper_roiselect"],[21,0,0,"-","main_Mosaic"],[22,0,0,"-","utils"],[21,0,0,"-","widget_ALS"],[21,0,0,"-","widget_ArPLS"],[21,0,0,"-","widget_Calibrate"],[21,0,0,"-","widget_Cut_every_n_spectra"],[21,0,0,"-","widget_DeTrending"],[21,0,0,"-","widget_Jupyter"],[21,0,0,"-","widget_KK"],[21,0,0,"-","widget_SG"],[21,0,0,"-","widget_images"],[21,0,0,"-","widget_mergeNRBs"],[21,0,0,"-","widget_scientificspin"]],"crikit.ui.classes_ui":[[21,1,1,"","BW"],[21,1,1,"","CompositeColor"],[21,1,1,"","SingleColor"]],"crikit.ui.classes_ui.BW":[[21,5,1,"","grayscaleimage"],[21,5,1,"","image"],[21,5,1,"","maxer"],[21,5,1,"","mean"],[21,5,1,"","minner"],[21,3,1,"","set_x"],[21,3,1,"","set_y"],[21,5,1,"","std"],[21,5,1,"","winextent"],[21,5,1,"","x"],[21,5,1,"","xlen"],[21,5,1,"","y"],[21,5,1,"","ylen"]],"crikit.ui.classes_ui.CompositeColor":[[21,5,1,"","image"],[21,5,1,"","mode_txt"],[21,5,1,"","xlen"],[21,5,1,"","ylen"]],"crikit.ui.classes_ui.SingleColor":[[21,5,1,"","image"],[21,5,1,"","imageGS"]],"crikit.ui.dialog_AbstractFactorization":[[21,1,1,"","DialogAbstractFactorization"]],"crikit.ui.dialog_AbstractFactorization.DialogAbstractFactorization":[[21,3,1,"","advance"],[21,3,1,"","applyCheckBoxes"],[21,3,1,"","clear"],[21,3,1,"","combiner"],[21,3,1,"","get_spatial_slice"],[21,3,1,"","get_spectral_slice"],[21,3,1,"","max_factors"],[21,3,1,"","mean_spatial"],[21,3,1,"","mean_spectral"],[21,3,1,"","runScript"],[21,3,1,"","setup"],[21,3,1,"","setupData"],[21,3,1,"","ui_changes"],[21,5,1,"","unselected_factors"],[21,3,1,"","updateCurrentRemainder"],[21,3,1,"","updatePlots"]],"crikit.ui.dialog_AbstractPlotEffect":[[21,1,1,"","AbstractPlotEffectPlugin"]],"crikit.ui.dialog_AbstractPlotEffect.AbstractPlotEffectPlugin":[[21,2,1,"","changed"],[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"]],"crikit.ui.dialog_AnscombeParams":[[21,1,1,"","DialogCalcAnscombeParams"]],"crikit.ui.dialog_AnscombeParams.DialogCalcAnscombeParams":[[21,3,1,"","dialogCalcAnscombeParams"],[21,3,1,"","updateInputValues"],[21,3,1,"","updateOutputValues"]],"crikit.ui.dialog_SVD":[[21,1,1,"","DialogSVD"]],"crikit.ui.dialog_SVD.DialogSVD":[[21,3,1,"","combiner"],[21,3,1,"","dialogSVD"],[21,3,1,"","get_spatial_slice"],[21,3,1,"","get_spectral_slice"],[21,3,1,"","max_factors"],[21,3,1,"","mean_spatial"],[21,3,1,"","mean_spectral"],[21,3,1,"","s_from_selected"]],"crikit.ui.dialog_kkOptions":[[21,1,1,"","DialogKKOptions"]],"crikit.ui.dialog_kkOptions.DialogKKOptions":[[21,2,1,"","CARS_AMP"],[21,2,1,"","NORM_TO_NRB"],[21,2,1,"","NRB_AMP"],[21,2,1,"","N_EDGE"],[21,2,1,"","PAD_FACTOR"],[21,2,1,"","PHASE_OFFSET"],[21,3,1,"","dialogKKOptions"],[21,3,1,"","goInteractive"]],"crikit.ui.dialog_model":[[21,1,1,"","DialogModel"]],"crikit.ui.dialog_model.DialogModel":[[21,3,1,"","changeSize"],[21,3,1,"","dialogModel"]],"crikit.ui.dialog_ploteffect":[[21,1,1,"","DialogPlotEffect"],[21,1,1,"","widgetDemoPlotEffectPlugin"]],"crikit.ui.dialog_ploteffect.DialogPlotEffect":[[21,2,1,"","TRANSPOSE_ARR"],[21,3,1,"","dialogPlotEffect"],[21,3,1,"","make_affected_plots"],[21,3,1,"","make_orig_plots"],[21,3,1,"","make_plots"],[21,3,1,"","plot_labels"],[21,3,1,"","widget_changed"]],"crikit.ui.dialog_ploteffect.widgetDemoPlotEffectPlugin":[[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"]],"crikit.ui.dialog_save":[[21,1,1,"","DialogSave"]],"crikit.ui.dialog_save.DialogSave":[[21,3,1,"","changeDataset"],[21,3,1,"","changeFilename"],[21,3,1,"","changePath"],[21,3,1,"","dialogSave"],[21,3,1,"","generateDatasetName"],[21,3,1,"","generateFilename"],[21,3,1,"","getFilename"],[21,3,1,"","getPath"]],"crikit.ui.dialog_subResidualOptions":[[21,1,1,"","DialogSubResidualOptions"]],"crikit.ui.dialog_subResidualOptions.DialogSubResidualOptions":[[21,2,1,"","RESIDUAL_FREQ"],[21,3,1,"","dialogSubResidualOptions"]],"crikit.ui.dialog_varstabAnscombeOptions":[[21,1,1,"","DialogAnscombeOptions"]],"crikit.ui.dialog_varstabAnscombeOptions.DialogAnscombeOptions":[[21,3,1,"","dialogAnscombeOptions"]],"crikit.ui.helper_plotOptions":[[21,1,1,"","plotStyle"]],"crikit.ui.helper_plotOptions.plotStyle":[[21,2,1,"","COLOR_DICT"],[21,2,1,"","COLOR_VEC"],[21,2,1,"","LINESTYLE_VEC"],[21,2,1,"","LINESTYLE_VEC_STR"],[21,2,1,"","LINEWIDTH"],[21,2,1,"","MARKERSIZE"],[21,2,1,"","MARKER_VEC"],[21,2,1,"","MARKER_VEC_STR"],[21,3,1,"","getLineStyle"],[21,5,1,"","linestyle_str"],[21,5,1,"","marker_str"],[21,5,1,"","qcolor"]],"crikit.ui.helper_roiselect":[[21,1,1,"","ImageSelection"]],"crikit.ui.helper_roiselect.ImageSelection":[[21,3,1,"","append_selection"],[21,3,1,"","clear_all"],[21,5,1,"","num_selections"]],"crikit.ui.main_Mosaic":[[21,1,1,"","DnDReorderListWidget"],[21,1,1,"","MainWindowMosaic"]],"crikit.ui.main_Mosaic.DnDReorderListWidget":[[21,3,1,"","dropEvent"],[21,2,1,"","reordered"]],"crikit.ui.main_Mosaic.MainWindowMosaic":[[21,3,1,"","addDataset"],[21,3,1,"","check_for_spatial_calib"],[21,3,1,"","check_for_spectral_calib"],[21,3,1,"","closeEvent"],[21,2,1,"","config"],[21,3,1,"","deleteDataset"],[21,2,1,"","frequency_calib"],[21,3,1,"","init_internals"],[21,3,1,"","is_duplicate_import"],[21,3,1,"","lineEditPixChange"],[21,3,1,"","list_reordered"],[21,3,1,"","promote_demote_list_item"],[21,3,1,"","save"],[21,3,1,"","setupListWidget"],[21,3,1,"","updateDatasets"],[21,3,1,"","updateFrequency"],[21,3,1,"","updateMosaicImage"],[21,3,1,"","updateParams"],[21,3,1,"","updateSlider"]],"crikit.ui.utils":[[22,0,0,"-","check_requirements"],[22,0,0,"-","roi"]],"crikit.ui.utils.check_requirements":[[22,4,1,"","check_requirements"]],"crikit.ui.utils.roi":[[22,4,1,"","roimask"]],"crikit.ui.widget_ALS":[[21,1,1,"","widgetALS"]],"crikit.ui.widget_ALS.widgetALS":[[21,3,1,"","asym_sub_val_change"],[21,3,1,"","asymspinboxchanged"],[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"],[21,3,1,"","selectFixedEnds"],[21,3,1,"","selectWNIncrease"],[21,3,1,"","setup_asym"],[21,3,1,"","setup_smoothness"],[21,3,1,"","spinBoxChanged"],[21,3,1,"","weight_sub_val_change"],[21,3,1,"","weightspinboxchanged"],[21,5,1,"","x"]],"crikit.ui.widget_ArPLS":[[21,1,1,"","widgetArPLS"]],"crikit.ui.widget_ArPLS.widgetArPLS":[[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"],[21,3,1,"","selectFixedEnds"],[21,3,1,"","spinBoxChanged"]],"crikit.ui.widget_Calibrate":[[21,1,1,"","widgetCalibrate"]],"crikit.ui.widget_Calibrate.widgetCalibrate":[[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,3,1,"","meas_vs_ideal"],[21,2,1,"","parameters"],[21,3,1,"","setup_calib"],[21,3,1,"","spinBoxChanged"]],"crikit.ui.widget_Cut_every_n_spectra":[[21,1,1,"","widgetCutEveryNSpectra"]],"crikit.ui.widget_Cut_every_n_spectra.widgetCutEveryNSpectra":[[21,2,1,"","cars_amp_offset"],[21,3,1,"","comboBoxChanged"],[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","norm_to_nrb"],[21,2,1,"","nrb_amp_offset"],[21,2,1,"","pad_factor"],[21,2,1,"","parameters"],[21,2,1,"","phase_offset"],[21,3,1,"","setupOptions"],[21,3,1,"","spinBoxChanged"]],"crikit.ui.widget_DeTrending":[[21,1,1,"","widgetDeTrending"]],"crikit.ui.widget_DeTrending.widgetDeTrending":[[21,3,1,"","changeWidget"],[21,3,1,"","widgetOptionsChanged"]],"crikit.ui.widget_Jupyter":[[21,1,1,"","QJupyterWidget"]],"crikit.ui.widget_Jupyter.QJupyterWidget":[[21,3,1,"","clearTerminal"],[21,3,1,"","executeCommand"],[21,3,1,"","printText"],[21,3,1,"","pushVariables"]],"crikit.ui.widget_KK":[[21,1,1,"","widgetKK"]],"crikit.ui.widget_KK.widgetKK":[[21,2,1,"","cars_amp_offset"],[21,3,1,"","changeCheckBoxConjugate"],[21,3,1,"","changeCheckBoxLockBias"],[21,3,1,"","changeCheckBoxNRBNorm"],[21,3,1,"","changeShowReal"],[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","norm_to_nrb"],[21,2,1,"","nrb_amp_offset"],[21,2,1,"","pad_factor"],[21,2,1,"","parameters"],[21,2,1,"","phase_offset"],[21,3,1,"","setupKK"],[21,3,1,"","spinBoxChanged"]],"crikit.ui.widget_SG":[[21,1,1,"","widgetSG"]],"crikit.ui.widget_SG.widgetSG":[[21,3,1,"","changeOrder"],[21,3,1,"","changeWinSize"],[21,3,1,"","fcn"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"]],"crikit.ui.widget_images":[[21,1,1,"","widgetBWImg"],[21,1,1,"","widgetColorMode"],[21,1,1,"","widgetCompositeColor"],[21,1,1,"","widgetGrayScaleInfoBar"],[21,1,1,"","widgetImageGainMath"],[21,1,1,"","widgetPopSpectrumGS"],[21,1,1,"","widgetSglColor"]],"crikit.ui.widget_images.widgetBWImg":[[21,3,1,"","checkBoxFixed"],[21,3,1,"","checkBoxRemOutliers"],[21,3,1,"","comboBoxCompress"],[21,3,1,"","createImg"],[21,3,1,"","createImg_Ext"],[21,3,1,"","initData"],[21,3,1,"","spinBoxMinMaxSet"]],"crikit.ui.widget_images.widgetCompositeColor":[[21,3,1,"","changeMode"],[21,3,1,"","createImg"],[21,3,1,"","createImg_Ext"],[21,3,1,"","initData"]],"crikit.ui.widget_images.widgetImageGainMath":[[21,2,1,"","COND_TYPE_STRINGS"],[21,2,1,"","OPERATION_FREQ_COUNT"],[21,2,1,"","OPERATION_STRINGS"],[21,3,1,"","clear"],[21,3,1,"","condOpsChange"],[21,3,1,"","operationchange"]],"crikit.ui.widget_images.widgetSglColor":[[21,3,1,"","applyGain"],[21,3,1,"","changeColor"],[21,3,1,"","disabled"],[21,3,1,"","gain1"],[21,3,1,"","initData"]],"crikit.ui.widget_mergeNRBs":[[21,1,1,"","widgetMergeNRBs"]],"crikit.ui.widget_mergeNRBs.widgetMergeNRBs":[[21,3,1,"","fcn"],[21,5,1,"","fullRange"],[21,3,1,"","kkChanged"],[21,2,1,"","labels_affected"],[21,2,1,"","labels_orig"],[21,2,1,"","parameters"],[21,3,1,"","pixChanged"],[21,3,1,"","rangeChanged"],[21,3,1,"","scaleChanged"],[21,3,1,"","wnChanged"]],"crikit.ui.widget_scientificspin":[[21,1,1,"","FloatValidator"],[21,1,1,"","ScientificDoubleSpinBox"],[21,4,1,"","format_float"],[21,4,1,"","valid_float_string"]],"crikit.ui.widget_scientificspin.FloatValidator":[[21,3,1,"","fixup"],[21,3,1,"","validate"]],"crikit.ui.widget_scientificspin.ScientificDoubleSpinBox":[[21,3,1,"","fixup"],[21,3,1,"","stepBy"],[21,3,1,"","textFromValue"],[21,3,1,"","validate"],[21,3,1,"","valueFromText"]],"crikit.utils":[[23,0,0,"-","breadcrumb"],[23,0,0,"-","datacheck"],[23,0,0,"-","general"],[23,0,0,"-","roi"],[24,0,0,"-","tests"]],"crikit.utils.breadcrumb":[[23,1,1,"","BCPre"]],"crikit.utils.breadcrumb.BCPre":[[23,2,1,"","PREFIX"],[23,3,1,"","add_step"],[23,5,1,"id0","attr_dict"],[23,2,1,"","backed_flag"],[23,3,1,"","backed_up"],[23,3,1,"","backup_pickle"],[23,5,1,"id1","cut_list"],[23,5,1,"","dset_name_suffix"],[23,5,1,"id2","id_list"],[23,3,1,"","load_pickle"],[23,5,1,"id3","num_steps"],[23,3,1,"","pop_to_last"],[23,2,1,"","process_list"]],"crikit.utils.general":[[23,4,1,"","arange_nonzero"],[23,4,1,"","expand_1d_to_ndim"],[23,4,1,"","expand_1d_to_ndim_data"],[23,4,1,"","find_nearest"],[23,4,1,"","lin_from_row_col"],[23,4,1,"","mean_nd_to_1d"],[23,4,1,"","np_fcn_nd_to_1d"],[23,4,1,"","pad"],[23,4,1,"","pad_dual"],[23,4,1,"","pad_edge_mean"],[23,4,1,"","row_col_from_lin"],[23,4,1,"","std_nd_to_1d"]],"crikit.utils.roi":[[23,4,1,"","pts_in_path"],[23,4,1,"","pts_to_verts"],[23,4,1,"","verts_to_path"],[23,4,1,"","verts_to_points_in_roi"]],"crikit.utils.tests":[[24,0,0,"-","test_breadcrumb"],[24,0,0,"-","test_general"],[24,0,0,"-","test_pad_edge_mean"]],"crikit.utils.tests.test_breadcrumb":[[24,4,1,"","test_breadcrumb"],[24,4,1,"","test_breadcrumb_offset"]],"crikit.utils.tests.test_general":[[24,4,1,"","test_pad_1d"],[24,4,1,"","test_pad_1d_0_width"],[24,4,1,"","test_pad_2d"],[24,4,1,"","test_pad_2d_0_width"],[24,4,1,"","test_pad_dual_1d"],[24,4,1,"","test_pad_dual_1d_all_0s"],[24,4,1,"","test_pad_dual_2d"]],"crikit.utils.tests.test_pad_edge_mean":[[24,4,1,"","test_pad_1d"],[24,4,1,"","test_pad_1d_0_width"],[24,4,1,"","test_pad_2d"],[24,4,1,"","test_pad_2d_0_width"]],crikit:[[3,0,0,"-","CRIkitUI"],[4,0,0,"-","cri"],[7,0,0,"-","data"],[9,0,0,"-","datasets"],[10,0,0,"-","io"],[15,0,0,"-","measurement"],[17,0,0,"-","preprocess"],[20,0,0,"-","transform"],[21,0,0,"-","ui"],[23,0,0,"-","utils"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","function","Python function"],"5":["py","property","Python property"]},objtypes:{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:function","5":"py:property"},terms:{"0":[2,4,5,7,11,15,17,18,21,23,25,26],"00":[17,21,23],"0001":18,"0006":2,"001":21,"002":2,"004":2,"01":[4,17,21],"03":21,"038483":[25,26],"04":[4,21],"05":[4,17,18],"06":21,"06543":[3,4,5,17,21],"07":3,"08":[4,5,17,18,21],"09":10,"1":[2,3,4,5,7,9,10,11,15,17,18,21,23],"10":[2,4,5,10,15,17,18,21,30],"100":[2,4,17,18,21,30],"1000":[15,18,30],"1002":[2,5],"1003":2,"1019":2,"1029":2,"103":2,"105":[25,28],"109":18,"11":[3,4,7,21],"1109":[17,18],"1133":2,"1147":2,"1167":2,"1173":2,"12":[2,7,10,18,21],"13":[2,10,18,21],"1363":[2,4,5,21],"1365":[2,4,5,21],"14":[2,17,21],"15":23,"1500":21,"1507":[3,4,5,17,21],"16":[10,15,21,23],"1600":2,"165955456":21,"17":[10,15,21,25,28],"18":[3,21,23],"19":10,"1948":18,"1975":2,"1998":[17,18],"1999":5,"1d":[3,4,7,9,15,17,21,23],"1e":[2,4,5,17,18,21],"1e3":[21,30],"1j":21,"1qt5":[25,26],"1st":15,"1x":2,"2":[2,3,4,6,7,10,15,16,17,18,21,23],"20":[4,18,21],"2005":[2,4],"2007":2,"2009":[2,4,5,18,21],"2010":18,"2011":[2,18],"2012":[17,18],"2013":2,"2014":2,"2015":21,"2016":[2,3,4,5,7,10,15,17,18,21,23,25],"2017":[25,26],"2056693":18,"21":[17,21,30],"22":[2,7,17,21],"2202675":[17,18],"2213":2,"23":[7,10,17,21,23],"24":21,"246":18,"25":21,"254":18,"26":[10,17,18,21],"27":[21,23],"2700":2,"2733":2,"2739":2,"28":[17,21],"2800":21,"2d":[7,8,17],"2qt5":[25,26],"3":[2,3,7,15,17,18,21],"30":21,"300":2,"3000":2,"31":17,"32":18,"33":23,"34":[2,4,5,21],"35":[4,10,18],"36":[10,21],"38":[2,21],"39":[17,21],"3d":[3,5,7,8,17,18],"3qt5":[25,26],"4":[2,3,5,18,21],"40":7,"400":21,"408":[2,4,5,17,25],"41":[17,23],"415":[2,4,5,17],"416":25,"42":[7,21],"43":[4,21],"44":[2,18,21],"443199618":2,"45":2,"46":21,"461":21,"47":[2,4,5,17,25],"48":21,"4824":5,"49":[17,18],"4x":2,"5":[2,4,7,15,18,21],"500":30,"51":18,"513":2,"525":2,"5278406":18,"53":[17,18],"54":21,"540":2,"55":[10,17],"5510120093941":21,"56":7,"57":21,"58":18,"5qt5":[25,26],"6":[2,4,7,21,25,26],"601":[2,4,21],"627":2,"634":2,"7":[2,10,21],"700":21,"745":3,"767":2,"771":21,"786":2,"79":[25,26],"8":[2,3,11,21],"809":2,"82":2,"83":2,"832":21,"900":2,"902":2,"91":2,"937":2,"980":2,"986":2,"99":18,"abstract":[15,21],"break":21,"byte":11,"case":[4,5,28],"class":[3,4,7,9,10,11,12,13,14,15,17,18,25],"default":[2,4,5,7,11,15,17,18,21],"do":[2,11,26],"final":9,"float":[4,5,7,11,15,17,18,19,21,23],"function":[2,3,4,5,7,11,12,21,23,25,26],"import":[2,8,10,14,30],"int":[4,5,7,9,11,15,17,18,21,23],"long":7,"m\u00e4kitalo":[2,17,18],"new":[2,3,7,11,21,23,25,26],"public":[25,28],"return":[2,4,5,7,9,10,11,12,13,15,17,18,21,22,23,25],"short":2,"static":[4,8,13,15,21,23],"true":[2,3,4,5,7,11,13,15,17,18,21,23],"try":[4,11,12],A:[2,5,11,13,17,18,23,25,26,30],AND:[8,25],AS:25,As:[25,26],BE:25,BUT:25,BY:25,FOR:25,For:[2,3,4,5,7,15,21,23],IN:25,IS:[11,23,25],If:[2,3,4,5,7,10,11,17,21,23,25,26],In:[2,7,21,28],Is:[11,21],It:[2,3,7,25,26],NO:25,NOT:[4,7,11,12,23,25],Not:7,OF:[3,25],OR:[13,25,30],On:[18,25,26],One:[2,13],THAT:25,THE:25,TO:25,That:[23,26],The:[4,5,7,11,17,18,23,25,26],Their:2,There:[2,25,26],These:[2,25,26],To:[2,4,25,26],WILL:25,WITH:[8,25],Will:11,_1:12,_:[7,21],_colormath:21,_dataset_nam:21,_factor:7,_h5py:11,_list_:7,_mplwin:21,_np:5,_rc:[25,26],a_0:7,a_1:7,a_2:7,a_:7,a_n:7,a_vec:7,ab:[5,16,21],about:28,absolut:15,abstract_:[3,17],abstractbaselin:18,abstractmeasurethre:15,abstractmeasuretwo:15,abstractmeasuretwoord:15,abstractploteffectplugin:21,accept:[7,23],access:[2,26],account:[2,7],accur:2,accuraci:[2,25],acquir:[2,3],across:[2,7,15],act:21,action:[3,13,17,21,25],activ:[3,21],actual:[2,11,21],add:[2,16,21,23,26],add_step:23,adddataset:21,addit:[2,15,23],addition:2,addl_attr:23,adjust:21,advanc:21,advis:[25,26],affect:[21,25],after:[2,3,5,17,23],again:2,agenc:25,agre:7,aid:2,aka:[3,17],al:[2,3,4,17,21],alessandro:18,algebra:2,algorithm:[3,4,17,19,21,25],all:[2,3,11,15,17,21,22,23,25],allow:[2,7,21],allow_dupl:21,along:[11,23],alpha:[2,17],alphabet:11,alreadi:[11,17],alscvxopt:18,also:23,alter:[3,10,12,17,18],alter_attr:11,alter_attr_sam:11,altern:[25,26],alwai:7,am:2,amazonaw:2,amp:[3,15,21],amplif:17,amplitud:[2,3,4,15,16,21],an:[1,3,4,6,8,11,12,14,16,17,18,21,23,24,25,26],anal:2,analysi:[2,3,17,18],analyt:[6,16],analyz:3,andrew:2,ani:[2,7,11,21,25,28],anoth:23,anscomb:[3,17,19,21,25],anscombe_inverse_exact_unbias:18,anscombeinvers:17,anti:[2,3,4,5,17,21,25],anyth:[4,5,8,26],api:[25,26],apidoc:[25,26],appar:[25,26],appear:[2,25,26],append:[7,21,23,26],append_select:21,appl:2,appli:[2,3,4,5,17,18,21,24],applycheckbox:21,applygain:21,approach:21,appropri:[3,21],approx:18,approxim:[2,3,18],apr:[7,17],ar:[2,4,5,7,11,12,15,17,18,21,22,23,25,26,28],arang:[23,30],arange_nonzero:23,arg:[3,12,21],argument:21,aris:25,aros:25,around:[2,23,25,26],arpl:[3,17,21],arplscvxopt:18,arrai:[3,4,5,7,11,17,23],arxiv:[3,4,5,17,21],ask:2,assert:8,associ:10,assum:[2,4,5,7,17,18,26,28],assymetri:21,asym_param:[4,17,18,21],asym_sub_val_chang:21,asymetri:21,asymmetr:[2,4,8,17,21],asymmetri:[2,4,17,21],asymspinboxchang:21,attr:23,attr_descript:13,attr_dict:[7,11,13,23],attr_kei:11,attr_val:11,attrbut:11,attribut:[7,10,11,12,13,23],au:21,august:18,author:[4,7,10,15,17,18,21,23,29],auto:[3,11,15],automat:[4,5],avail:[11,28],averag:[2,3,17,21,23],avoid:25,awgn:2,ax:8,axi:[4,5,7,17,21,22,23],axison:21,aysmmetr:19,b:[2,7,21],back:[2,3,7,23],backed_flag:23,backed_up:23,background:[2,4,5],backup:[3,23],backup_pickl:23,bad_valu:[4,5],balanc:15,banner:21,bar:21,base:[2,3,4,7,9,11,12,13,15,17,18,21,23,25],baselin:[2,3,4,17,21],basic:24,bat:[25,26],bcar:[3,10,21,25],bcpre:23,becaus:11,been:2,befor:[2,5,17,21],being:[2,10,21],below:[4,5,7,18],best:28,between:[2,4,15,16,17],bg:5,bia:2,big:8,bijaoui:[17,18],binari:22,binomi:18,bio:2,biolog:2,biometrika:18,bisect:2,black:2,blank:7,blend:2,block:2,blue:21,boca:5,boelen:[2,4],bool:[3,4,5,7,10,11,13,17,21],borri:2,both:2,boundari:23,box:[2,13,21],breadcrumb:[3,24,29],broadband:[2,4,5,21],browser:26,bug:[25,26],built:[13,25,26],burden:2,burnden:4,button:[2,3],buttonid:21,bw:21,bytes_:11,c:[2,3,4,5,17,21,25],calc:15,calc_anscombe_paramet:17,calcanscombeparam:3,calcul:[2,3,4,5,7,15,17,18,19,21],calib:7,calib_data_agre:7,calib_dict:21,calib_fcn:7,calib_obj:7,calib_orig:7,calib_pix_wl:7,calib_pix_wn:7,calib_vec:21,calib_wl:21,calibr:[3,7,21,25],calibrationreset:3,call:21,cambridg:[17,18],camp14:2,camp16:2,camp:[2,3,4,5,17,21,25],can:[2,5,7,8,21,23,25,26],cancel:2,canva:21,car:[2,3,4,5,17,21,25],cars_amp:21,cars_amp_offset:[4,21],cauchi:[6,16],caus:2,ccampjr:[25,26],cd:26,ceas:4,center:[2,7],center_wl:21,certain:[2,25,26],chanc:17,chang:[2,3,12,13,21],changecheckboxconjug:21,changecheckboxlockbia:21,changecheckboxnrbnorm:21,changecolor:21,changedataset:21,changefilenam:21,changemod:21,changeord:21,changepath:21,changes:21,changeshowr:21,changeslid:3,changewidget:21,changewins:21,characterist:28,charl:[3,25],chc:[4,7,10,15,17,18,21,23],check:[2,3,7,11,12,21,22,23],check_for_spatial_calib:21,check_for_spectral_calib:21,check_requir:[3,21],check_same_typ:11,check_type_compat:[11,12],checkbox:21,checkboxfix:21,checkboxremoutli:21,checkcompositeupd:3,checkint:11,checkshowoverlai:3,chem:2,choos:26,chunk:[8,11],ciceron:[2,3,4,5,17,21,25],circl:21,cite:18,classes_ui:[3,29],classmethod:15,clean:26,clear:21,clear_al:21,cleartermin:21,click:[2,3],clone:25,close:[2,3,11,12,18],close_if_file_not_fid:11,closeev:[3,21],closest:[7,23],cm:[2,3,7,21],cmap:21,co:2,code:[25,28],coeffici:7,coher:[2,3,4,5,17,21,25],col:23,collabor:28,collect:[2,7],color:[3,7,21,25],color_dict:21,color_vec:21,column:[3,5,8,17],com:[2,21,25,26],combin:21,combobox:[13,21],comboboxabovemax:21,comboboxchang:21,comboboxcompress:21,comboboxgroupselect:13,come:[2,3],command:[3,21,25,26],compar:[2,3,4,5,17,21,25],comparitor:2,compat:11,complet:2,complex:[2,3,5,9,11,15,17,25],compon:[2,4,5,17,21,25],componenet:17,compos:25,composit:[3,21],compositecolor:21,compress:21,comput:[2,4,5,7,17],concern:21,cond_type_str:21,conda:26,condinequalitychang:3,condit:[2,3],condopchang:3,condopschang:21,config:[3,7,10,13,21],config_dict:10,configur:[10,11],conform:25,conjug:[4,5,17,21],connect:[2,3,25],consequenti:25,consid:[4,25],consol:21,constant:[2,4,21,23],constant_pad_width:23,construct:21,contain:[2,7,11,13,21,23,25],content:[25,29],contentpag:2,contract:25,contradictori:7,contribut:[2,17],control:[5,21],conveni:[7,21],convent:13,convers:[2,10],convert:[2,7,11,19,23,25],convert_sgl_np_to_num:11,convert_to_str:11,coordin:[15,23],copi:[5,17],copyright:[25,28],core:3,correct:[3,4,5,6,17,21,22,25],correspond:[4,21],count:[18,23],counter:23,cours:28,cplx:21,crc:5,creat:[3,4,7,10,15,17,18,21,22,23,26],createimg:21,createimg_ext:21,createimgbw:3,creation:[11,12],cri:[3,21,25,29],crikit2:2,crikit:[25,26,29,30],crikit_launch:[3,30],crikitui:[29,30],crikitui_process:3,crop:[3,8,21,29],cross:2,cs:18,csv:10,csv_nist:[3,29],csv_nist_import_data:10,ct:23,ctr:7,ctr_wl0:7,ctr_wl:7,cube:21,current:[2,7,13,17,21,23],current_dataset_nam:21,current_filenam:21,current_path:21,cursor:2,custom:2,custombann:21,cut:[3,17,21,23],cut_list:23,cut_m:[17,21],cuteverynspectra:[3,17,21],cutoff:15,cutoff_d1:15,cutoff_d2:15,cvxopt:[25,26],cwt_diff:15,cwt_width:15,cyan:[2,21],d:[2,5,7,21,23],damag:25,dark:[3,17,19,21,25],dark_arrai:[17,21],dark_sub:21,dark_subtract:17,dash:21,data:[3,4,5,10,11,15,17,18,19,21,23,25,29,30],data_in:21,data_obj:17,data_to_match:23,databas:2,datacheck:[3,29],datagroupchang:13,dataset:[3,8,10,11,12,13,16,19,21,23,25,29],dataset_nam:3,dataset_name_path:21,datasetnam:23,datasetselect:13,dc:[4,21],de:2,deactiv:3,deal:7,debat:7,dec:[18,21],decod:11,decompos:[2,17],decomposit:[17,25],defaultconfig:11,defin:[2,7,8,11,23],degelder07:2,delet:[25,26],delete_preview_roi:3,deletedataset:21,deleteoverlai:3,demo:21,demonstr:2,denois:[3,18,25,29],denoisedark:3,denoisenrb:3,denot:10,depend:3,deriv:[4,7,15,17,21],derviv:2,describ:[3,7,12,17,22,23,25,26],descript:18,descriptor:7,desid:7,desir:26,detector:[2,21],determin:2,detrend:[2,3,17,19,21],dev:2,develop:[1,28],development:[25,26],deviat:[2,7,17,18,21],diagon:17,dialog:[2,3,12,13],dialog_abstractfactor:[3,29],dialog_abstractploteffect:[3,29],dialog_anscombeparam:[3,29],dialog_kkopt:[3,29],dialog_model:[3,29],dialog_ploteffect:[3,29],dialog_sav:[3,29],dialog_subresidualopt:[3,29],dialog_svd:[3,29],dialog_varstabanscombeopt:[3,29],dialogabstractfactor:21,dialoganscombeopt:21,dialogcalcanscombeparam:21,dialogdarkopt:21,dialogkkopt:21,dialogmodel:21,dialogploteffect:21,dialogsav:21,dialogsubresidualopt:21,dialogsvd:21,diamond:21,diamondd:21,dict:[4,5,7,10,11,17,21,23],dictionari:[7,11,12,21,23],differ:[2,4,12,15,21],digit:2,dimenens:9,dimens:[7,23],dimension:[5,23],diment:5,direct:[15,18,25],directli:15,directori:[3,11,13,25,26],disabl:21,disclaim:25,discontinu:4,disk:23,displai:[2,3,21,26],distort:[2,15],distribut:[2,25,26],divi:8,divis:[15,16],dlm:3,dndreorderlistwidget:21,doc:[25,26],docomposit:3,docstr:17,doe:[2,4,7,8,25,28],doesn:21,doi:[5,17,18],dokk:3,domain:[2,4,5,21,25,28],domath:3,dot:21,doundo:3,down:[2,8,11,12,14,16,17,19,21],download5:[25,26],download:[25,26],drag:21,drop:[2,21],dropdown:13,dropev:21,dset:[10,11,12,21],dset_list:[10,11],dset_name_suffix:23,dset_overwrit:11,dtype:[7,9,19,23],due:19,dump:23,dure:[2,7],duti:28,dynam:7,e:[2,3,7,11,15,17,21,23,25,26],each:[2,4,10,17,21,23],easili:26,ed:5,edg:[2,4,5,7,23],edge_pad_width:23,edit:2,effec:5,effect:[4,7,17,18,21],eiler:[2,4],eilers05:2,either:[2,3,23,25],elastin:2,element:[7,17,23],els:[11,17],elsewher:26,employe:[25,28],empti:[11,12],enabl:[2,7,11,26],end:[2,3,4,21,26],endors:28,endpoint:21,enforc:4,enough:2,ensur:8,enter:[2,3,21,25],entir:11,entri:[3,7,10,11,23,25,26],equal:[4,21,23],err:2,error:[3,4,5,6,8,11,17,21,25],error_correct:[3,29],errorcorrectamp:3,errorcorrectphas:3,errorcorrectscal:3,es:[7,23],estim:2,etc:[7,21],even:[2,7,17],event:25,everi:[2,3,17,21],every_n:[17,21],everyth:23,ex:26,exact:[2,4,17,18],exampl:[2,7,21,30],except:[7,23],excit:2,excl_filt:13,exclud:[11,13,23],exclus:11,execut:[3,21],executecommand:21,exhaust:1,exist:[3,11],expand:[2,23],expand_1d_to_ndim:23,expand_1d_to_ndim_data:23,expans:2,expens:2,experi:2,experiment:2,explicitli:2,explor:2,express:[25,28],extens:[2,21],extent:[7,21],extern:2,extract:2,extrem:2,extrema:4,f1:[15,16],f2:[15,16],f3:15,f:[2,3,4,5,7,9,17,18,25,26,30],f_full:7,f_label:[3,30],f_pix:7,f_unit:[3,30],factor:[2,3,4,17,21,29],factorizedhsi:7,factorizedspectra:7,fail:17,fall:23,fals:[2,3,4,5,7,11,12,17,18,21,23],famili:11,far:21,faster:[7,17],fcn:[7,21,23],featur:2,feder:[25,28],fee:25,feel:2,feet:30,few:25,fft:15,fftsignalmetr:15,fftspatialnois:[3,29],fi:18,fid:[11,12],fidorfil:[11,12],figur:21,file:[3,8,10,11,12,13,14,21,23,25,26],filenam:[3,10,11,12,13,21,23],filename_data:10,filename_head:10,fileopen:13,fileopendlmnist:3,fileopenhdfmacrorasternist:3,fileopenhdfnist:3,fileopenhdfnistooc:3,fileopensuccess:3,fill:2,filter:[2,11,12,13,21],filterdataset:13,filterlist:11,find:[2,7,11,15,17,23],find_nearest:23,fine:2,fingerprint:2,finish:2,finland:18,first:[2,3,10,17,21],first_or_last:17,firstsecondthird:13,fit:[2,25],fix:[2,21,25,26],fix_const:[4,17,18,21],fix_end_point:[4,17,18,21],fix_rng:[4,17,18,21],fixup:21,flag:23,flip:8,float32:11,floatvalid:21,fname:23,foi13:2,foi:[2,17,18],follow:[13,23,26],font:[25,26],forc:[4,5,25,26],form:[18,21],format:[21,23],format_float:21,formerli:[3,25],formula:5,forward:[2,17,18],fourier:[2,5],fourth:2,frame:21,free:[2,25],freedom:25,freeli:25,freq:[2,3,4,7],freq_vec:7,freqcalib:3,freqcaliborig:3,frequenc:[2,3,4,5,9,21,29,30],frequency_calib:21,freqwindow:3,fri:[7,15,17],from:[3,4,5,7,10,11,13,17,21,22,23,25,26],fsignal:18,full:[1,3,5,7,11,12],fulldsetpath:11,fulli:2,fullpath:11,fullrang:21,g:[2,3,7,11,15,17,21,23,26],g_mean:17,g_std:17,gain1:21,gain:[2,21],gauss:[17,18],gauss_mean:[17,18],gauss_std:[17,18],gaussian:[2,17,18,21],gelder:2,gen_anscombe_exact_unbias:18,gen_anscombe_forward:18,gen_anscombe_inverse_closed_form:18,gen_anscombe_inverse_exact_unbias:18,gener:[3,17,18,21,24,25,26,29],generatedatasetnam:21,generatefilenam:21,get:[3,11,12,25,26],get_attrs_dset:11,get_closest_freq:7,get_dataset:11,get_group:11,get_hierarchi:11,get_index_of_closest_freq:7,get_preview_spectra:3,get_rand_spectra:7,get_spatial_slic:21,get_spectral_slic:21,getfiledataset:13,getfilenam:21,getlinestyl:21,getpath:21,gist:21,git:26,github:[21,25,26],given:[4,7,11,21,23],glass:2,global:5,go:[3,4,5],goe:21,gointeract:21,golai:[2,3,4,21],gov:[3,25],govern:[25,28],grant:25,graphic:[13,25],grayscal:[3,21],grayscaleimag:21,green:21,group1:[11,12],group2:11,group:[11,12,13],groupnam:12,grp_w_dset:11,guarante:28,gui:[3,13,25,26],gussem:2,h5:[12,13],h5loadgui:11,h5py:[11,25,26],h:[2,3,4,5,8,17,21,25],ha:[2,6,13,16,17,21],haar:15,half:2,handbook:5,harm:2,hartshorn:2,have:[11,19,21],hdf5:[3,8,11,12,14,21,23,29],hdf:[3,10,11,12,23],hdf_dataset2:8,hdf_dataset:[12,14],hdf_import_data:10,hdf_import_data_macrorast:10,hdf_is_open:[11,12],hdfload:13,hdftoclass:23,header:[10,26],heddleston:2,height:21,help:[2,26],helper_plotopt:[3,29],helper_roiselect:[3,29],here:2,herebi:25,hereund:25,hermiti:17,hexagon:21,hierarch:11,hierarchi:12,high:[2,4,5],higher:[4,7],highest:[7,10],highli:4,hight:2,hilb_kwarg:[4,5],hilbert:[2,4,5,6,16],hilbertfft:5,home:13,horiz:21,how:6,howev:2,hsi:[3,7,8,9,14,16,17,19,21,23,25,30],hsi_dataset:16,hsi_i:9,hsi_r:9,html:[25,26],http:[2,5,18,21,25,26],huang:2,hyperspectr:[2,7,29],i:[2,7,11,17,21,23],ibil:12,icon:3,id:[11,12,23],id_list:23,ideal:2,ident:25,identif:28,identifi:[2,21,23,28],idx:7,ie:[2,9,17,23],ieee:[2,17,18],ignor:2,im:21,imag:[2,7,9,15,17,18,21,29,30],imageg:21,imageri:[3,7,21,25],imageselect:21,imaginari:[3,4,5,15,17,21,25],img:[3,7,15,21],img_al:21,img_shap:21,img_shp:15,imgi:22,imgload:21,imgx:22,implement:[2,5,7,17,21],impli:[25,28],implicitli:2,import_csv_nist_special1:10,import_hdf_nist_speci:10,improv:2,in_freq:7,in_list:11,inappripri:12,incid:2,includ:[11,13,25,26],inclus:[7,15],incompat:19,incorpor:2,increas:[2,4,5,21],increment:2,independ:[2,7,21],index:[1,4,5,7,23,25],indic:2,indirect:25,individu:[25,26],inequ:3,inf:[4,5],info:21,inform:[2,17,25],infring:25,inidividu:11,init_intern:21,initdata:21,initi:[7,21],injuri:25,input:[4,5,7,11,12,15,17,21,23,25],input_a:11,input_b:11,insid:11,inspect:[3,10,12],instal:[12,22],instanc:[3,7,21],instanti:14,instead:23,institut:[25,28],int32:11,integ:7,intens:[7,17,21],inter:2,interact:[2,3,13,25],intercept:21,interest:[1,3,7,22],interfac:[2,3,13,25],intern:21,interpol:[3,4],intrins:2,inv:2,invers:[3,17,18,25],inverseanscomb:3,involv:2,io:[3,25,26,29],ipython:[21,25],is2d:7,is3d:7,is_duplicate_import:21,is_fid:11,isclos:23,issamedim:7,item:[7,11],iter:[2,4,21],its:[25,28],j:[2,3,4,5,17,18,21,25],januari:[18,25,26],jdreaver:21,join:11,journal:[3,4,5,17,21,25],jr:[2,3,4,5,17,21,25],jul:21,jun:[4,15,17,23],jupyt:25,just:[3,8,11,17,25],k:2,karuna16:2,karuna:2,keep:2,keep_filtered_item:11,kei:[7,10,11,12],kept:2,kind:25,kk:[2,3,6,21,29],kkchang:21,kkrelat:5,kramer:[3,4,6,21,25],kramerskronig:4,kronig:[3,4,6,21,25],kwarg:[3,4,5,12,17,18,21],l:[2,17,18],label:[3,7,21],labels_affect:21,labels_orig:21,lambda:[2,17,21],langbein:2,larg:[2,7],larger:7,last:[2,3,17],lathia:2,launch:3,lazi:11,lazy5:[3,10],lead:[17,21],least:[2,4,17,19,21],lee11:2,lee:[2,3,4,5,17,21,25],left:[2,3,4,5,21],left_side_scal:4,length:[2,4,5,7,21],less:[4,21],let:21,lett:[2,4,5,21],level:[2,11,17,18],liabl:25,librari:22,lighter:2,like:[1,4,5,11,21],limit:[3,7,21,25],lin_from_row_col:23,linalg:17,line:[2,3,10,21,25],linear:[2,3,23],linearsegmentedcolormap:21,lineeditfreqchang:3,lineeditpixchang:[3,21],linestyle_str:21,linestyle_vec:21,linestyle_vec_str:21,linewidth:21,linspac:30,list:[1,7,10,11,12,13,21,23],list_reord:21,listwidget:21,liu09:2,liu:[2,4,5,21],live:21,llc:5,lnla:18,load:[3,11,12,21,23],load_pickl:23,loaddark:3,loaddarkdlm:3,loader:13,loadnrb:3,loadnrbdlm:3,local:18,locat:[2,3,15,22],log:2,long_nam:21,longer:[2,21,30],look:2,lorentz:[6,16],lose:26,loss:25,low:[4,5,18],ls:21,lw:21,m:[2,3,4,5,11,17,18,21,25,30],macro:[3,11,29],macrostag:3,made:2,magenta:[2,21],magnitud:2,mai:[2,7,10,17,23,25,26],main:[2,3],main_mosa:[3,29],mainwindow:21,mainwindowmosa:21,make:[2,7,9,11,23,25,26,28],make_affected_plot:21,make_dataset:[8,19],make_hsi:9,make_orig_plot:21,make_plot:21,make_spectra:9,makebcarsphantom:3,makeramanphantom:3,mani:[2,23],manner:4,manual:[2,3,21,25,26],mar:21,mark:[12,23],marker_str:21,marker_vec:21,marker_vec_str:21,markers:21,markku:18,masia:2,mask:[7,21,22,23],match:[4,7,17,18,23],materi:2,math:[2,3,4,6,15,16,21],mathemat:21,matlab:18,matplotlib:[21,22,25,26],matric:[2,5],matrix:[2,5,17,21],matter:[2,25,26],max:[2,21],max_factor:21,max_it:[4,17,18,21],maxab:21,maxer:21,maximum:[3,4,15,16,21],mean:[2,3,4,5,7,17,18,19,21,23],mean_axes_stat:8,mean_nd_to_1d:23,mean_spati:21,mean_spectr:21,meas_vs_id:21,measur:[2,3,7,25,29],measurepeak:15,measurepeakadd:15,measurepeakbwtrough:15,measurepeakdivid:15,measurepeakmax:15,measurepeakmaxab:15,measurepeakmin:15,measurepeakminab:15,measurepeakminu:15,measurepeakmultipli:15,measurepeaksum:15,measurepeaksumabsreimag:15,meausur:15,median:2,memo:13,memori:[2,5],merchant:25,merg:[3,4,21],merge_nrb:[3,29],mergenrb:[3,4,21],met:2,meta:[7,10,21],meta_config:[3,29],meta_process:[3,29],metadata:23,method:[2,3,6,7,8,11,13,15,16,21],metric:15,microscopi:2,migler:2,mimic:21,min:[2,21],min_diff:[4,17,18,21],min_valu:[4,5],minab:21,minim:[2,7],minimum:[2,4,15,16],minner:21,minor:[2,18],minu:2,minut:2,mix:[2,17,18],mnadatori:23,mode:[3,11,21,23,26],mode_txt:21,model:[2,3,7,17,18,29],modif:26,modifi:[21,25],modul:[1,25,29],modulu:5,moen:2,molecul:2,mon:[2,4,10,18,21],moon:2,more:[2,4,10,11,13,17],mosaic2d:7,mosaic:[3,21,29],mosaic_mask:7,mosaic_shap:7,mosaicful:7,mosaictool:3,most:[1,2,23],mous:[2,3],move:23,mpl:[3,22],mpl_kwarg:21,mt:7,mu:[3,30],multi:26,multipl:[2,3,4,5,7,15,16,17,21],multipli:[2,17,18],murin:2,murtagh:[17,18],must:[2,7,11],must_exist:11,n:[2,3,7,17,21,23],n_:17,n_edg:[4,5,21,23],n_lambda:17,n_noise_test:15,n_pix:7,n_spectra:17,nacl:2,name:[3,10,11,12,13,21,23],nan:[4,5],narendra75:2,narendra:2,nat:2,nation:[25,28],nd:[21,23],nd_axi:7,nd_fcn:7,ndarrai:[3,4,5,7,9,10,11,15,17,18,21,22,23],ndim:[7,23],nearest:23,nearest_valu:23,necessari:[2,22,26],necessarili:28,need:[2,21,23,25,26],neg:18,neighbor:[4,5],next:[2,21],nist:[2,3,10,25,28],nl:2,nm:[3,7],nmf:2,no_it:5,nois:[2,15,17,18,21],noise_sigma:15,noiseless:2,noisi:18,non:[2,3,11,12,17,18,23],none:[4,5,7,9,10,11,13,15,17,18,21,23],nonh5util:[3,10],nonlinear:2,nonneg:2,nonreson:[2,4],nor:28,norm_to_nrb:[4,5,21],normal:[4,5,17,21,25],note:[2,3,4,5,7,8,11,15,17,18,19,21,23,25,26],notic:25,nov:4,now:[2,25,26],np:[11,30],np_fcn_nd_to_1d:23,np_vec:23,nrb:[3,4,5,21,25],nrb_amp:21,nrb_amp_offset:[4,21],nrb_left:[4,21],nrb_right:[4,21],nrbfromroi:3,nrbload:21,nuclei:2,num:[3,7,21],num_current_plot:21,num_select:21,num_step:23,number:[4,5,7,21,23],numcolor:3,numer:[3,11,15,21,25],numpi:[3,5,9,11,17,23,25,26,30],o:[21,25,26],obj:7,object:[4,7,9,10,11,12,13,15,17,18,21,22,23],occur:3,oct:21,octagon:21,odd:2,offici:28,offset:[2,4,5,17,21,23,24],ok:2,old:[11,25,26],older:[25,26],one:[2,5,7,23,25,26],onli:[2,3,4,5,7,11,21,23],only_show_grp_w_dset:13,op:7,op_list_:7,op_list_freq:7,op_list_pix:7,op_rang:7,op_range_:7,op_range_freq:7,op_range_pix:7,op_siz:7,opchang:3,open:[2,3,11,28],oper:[2,3,7,11,17,21,23],operar:7,operation_freq_count:21,operation_str:21,operationchang:21,oppos:5,opposit:21,opt:[2,4,5,21],optic:2,optim:[2,17,18],option:[4,5,7,15,17,18,21,23],order:[2,4,11,15,17,18,21,28],ordereddict:[11,12],org:5,orient:[4,5],origin:[5,7,11,17,18,21,23],other:28,otherwis:[11,21,25],out:[3,5,7,21,23,25,26],outer:2,output:[3,4,5,11,15,21,25],output_cls_inst:10,over:[3,4,5,7,17,21],over_spac:7,overview:25,overwrit:[4,5,7,11,17],own:25,p:[2,4,17,21],packag:[25,26,29],pad:[2,4,5,21,23],pad_dual:23,pad_edge_mean:[23,24],pad_factor:[4,5,21],pad_width:23,pair:[7,21,23],pancrea:2,panel:21,paramet:[2,3,4,5,7,9,10,11,13,15,17,18,19,21,22,23],parent:[13,21],part:[15,25],parti:28,particular:[2,10,21,25],pass:[7,11,12],patch:2,path:[3,10,11,12,13,21,22,23],patterson75:2,patterson:2,pca:2,pdf:2,peak:[2,15,16,21],peakamp:[3,29],peakfind:[3,29],pec:4,penal:21,pentagon:21,perform:[2,3,4,5,7,15,17,21,25,28],permiss:25,person:25,phantom:[3,21,25],phase:[3,4,6,17,21,25],phase_offset:[4,5,21],phaseerrcorrect:4,phenylalanin:2,photon:2,physic:[7,22],pi:[4,5],pickl:23,piec:2,pip3:[25,26],pipermail:[25,26],pix:[4,7],pix_vec:7,pixchang:21,pixel:[2,3,4,7,15,17,21,23],pk:15,place:19,plai:6,plain:21,platform:[3,25],pleas:18,plot:[2,3,7,21,25,26],plot_label:21,plot_list_:7,plot_list_freq:7,plot_list_pix:7,plot_rang:7,plot_range_:7,plot_range_freq:7,plotdarkspectrum:3,ploteffect:21,ploteffectplugin:21,plotleftnrbspectrum:3,plotnrbspectrum:3,plotrightnrbspectrum:3,plotstyl:21,plotter:2,plotter_show:3,plu:[2,21],plug:21,plugin:21,point:[2,3,4,21,22,23],pointspectrum:3,poisson:[2,17,18,21],poisson_multi:[17,18],polygon:3,polyhedrom:2,polyhedron:2,polym:2,polynomi:[2,7,21],polyord:21,pop:[2,3,21],pop_to_last:23,popul:13,populate_attr:13,populategroup:13,portion:[2,3,17,25],posit:17,potenti:2,poularika:5,pp:18,pre:[2,3,23,25,26],prefix:[7,23],prepend:[11,12],preprend:11,preprocess:[3,25,29],present:[3,11,21],press:[2,3,5,17,18],prevent:[4,25,26],preview:[2,3],preview_roi:3,previou:23,previous:[4,21],primari:[2,3],primarili:11,principl:2,print:[7,21],printtext:21,prior:[2,4,11,21],prioriti:10,probabl:26,probe:[7,21],proc:18,process:[3,4,10,17,18,21,23,25],process_desc:23,process_list:23,produc:2,product:[2,28],profil:2,program:21,project:28,promote_demote_list_item:21,properli:[2,12],properti:[4,7,9,15,18,21,23,25],protect:[25,28],protein:2,provid:[2,4,5,7,11,12,14,17,25],pseudo:25,pt:2,pt_sz:7,pth:[10,11,13],pts_in_path:23,pts_to_vert:23,pull:[25,26],pure:25,purpos:[7,25,28],pursuant:[25,28],push:[4,21,26],pushbutton:2,pushvari:21,pwd:11,py:[3,21,26],pyqt5:[3,12,13,21,25,26],pytestmark:12,python3:[3,25,26,30],python:3,pyuic5:[25,26],qcloseev:[3,21],qcolor:21,qdialog:[11,21],qdoublespinbox:21,qdropev:21,qjupyterwidget:21,qlistwidget:21,qmainwindow:[3,21],qobject:21,qq:15,qt5:[25,26],qt:[13,25,26],qt_:[25,26],qt_hdfload:[10,11],qtconsol:21,qtgui:21,qthdfload:[10,11],qtwidget:[3,13,21],quad:7,quadrat:2,qualiti:28,quandrant:2,quantifi:15,quantit:[2,3,4,5,17,21,25],queri:10,qvalid:21,qwidget:21,r:[2,3,11,30],rais:[2,8,11,19],raman:[3,4,5,17,21,25],randn:30,random:30,rang:[3,4,7,8,15,17,21],rangechang:21,raster:3,rather:[1,3,4,8,10,21,26],ratio:[2,4,5,15],raton:5,raw:[2,3,21],re:[2,21],read:[7,23],readili:2,real:[2,4,5,9,15,21,25],reason:12,rebuild:25,recalc_cutoff:15,recent:23,recommend:[2,4,28],recompos:[2,17],reconstruct:[2,17,21],red:21,reduc:[2,4],reduct:21,redux:[4,17,18,21],redux_factor:17,ref:4,refer:[3,4,5,17,18,21,25],reflect:2,region:[3,7,22,23],regular:21,rel:[13,17,26],relat:[4,6,12,16,21,25],relationship:[2,5,15],releas:[3,25,26],reliabl:28,remain:[17,21],rememb:2,remov:[4,21,23],reorder:21,rep:7,rep_arrai:[17,21],repetit:[7,17,21],replac:[11,17,21],replic:[3,17,29],repons:[4,21],requir:[2,3,25,26],reset:21,reshap:8,resid:21,residu:[3,21],residual_freq:21,resolut:2,reson:2,respond:3,respons:28,rest:23,restor:2,result:[2,21,25],retranslateui:13,retriev:[3,4,6,13,17,21,25],return_family_typ:[11,12],return_fid_from_fil:11,return_pad:5,reveal:2,reweight:21,ribbon:[2,3],rich:2,rich_jupyter_widget:21,richjupyterwidget:21,right:[2,3,4,5,16,21],riverbankcomput:[25,26],rlate:21,rng:[4,17,18,21],roi:[3,21,29],roimask:22,roispectrum:3,root:5,rosetta:10,rosetta_queri:10,routin:18,row:[3,8,17,23],row_col_from_lin:23,run:[8,21,25],runscript:21,s3:2,s:[2,3,4,5,7,10,12,13,15,17,21,23,25,26],s_from_select:21,salt:2,same:[12,15,17],sampl:[2,4,8,12,14,16,17,21],sat:[17,21,23],save:[3,11,12,25],save_dataset_nam:21,save_filenam:21,save_path:21,savitki:[2,3,4,21],scale:[3,4,6,17,18,25],scale_left:21,scalechang:21,scaleerrcorrectsg:4,scan:10,scatter:[2,3,4,5,17,21,25],scienc:2,scientificdoublespinbox:21,scientificspin:21,scipi:26,sciplot:[21,25,26],scm:26,screenshot:2,script:21,section:[25,28],see:[1,4,7,17,21,25,26],select:[2,3,13,17,21,22],selectfixedend:21,selection_mad:13,selector:21,selectwnincreas:21,self:[3,21,23],sender:3,sent:[4,5],sep:10,separ:[2,4,15,21],seri:[2,8,19],servic:25,set:[2,3,4,5,7,9,10,12,17,21],set_i:21,set_preview_roi:3,set_x:21,setcondfreq1:3,setcondfreq2:3,setcondfreq3:3,setopfreq1:3,setopfreq2:3,setopfreq3:3,setup:[3,8,12,14,16,18,19,21,26],setup_asym:21,setup_calib:21,setup_smooth:21,setupdata:21,setupkk:21,setuplistwidget:21,setupopt:21,setupui:13,sever:[2,4,21],sf:2,sg:21,sgl_color_list:21,sgl_color_widget_list:21,sh:23,shade:2,shall:25,shape:[7,11,17,18],shell:25,shift:21,shot:2,should:[2,4,5,7,26],shoulder:15,show:[2,21,25,26],showcbar:21,shown:2,showpreviewroi:3,side:[3,4,23],sigma_g:17,signal0:18,signal:[2,3,4,5,7,15,17,18,21,23],signatur:2,similar:[2,7,11,23],simpl:21,sinc:21,singl:[2,3,10,11,21],singlecolor:21,singular:[17,21,25],size:[4,7,21,23],skip:[12,25],skipif:12,slide:2,slider:[3,21],sliderpress:3,sliderreleas:3,slope:21,slot:3,slowest:2,slowli:2,small:[2,8,25,26],smooth:[2,4,17,21],smoother:21,smoothness_param:[4,17,18,21],so:[21,26],softwar:[18,25,26,28],solid:[2,21],some:[7,21],soon:3,sort:[11,25,26],sort_attr:11,sourc:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,28],space:[7,17],spatial:[2,7,9,15,17,21,25],spec:[25,26],special:25,special_nist_bcars1_sample_scan:10,special_nist_bcars2:10,specialdemosaicrgb:3,specialestcalibration1:3,specif:[3,4,10,25,28],specifi:[10,15,17,21],spect:2,spect_al:21,spectra:[3,4,5,8,10,14,17,19,21,23,25,29],spectral:[2,4,5,7,17,21,25],spectromet:2,spectrosc:2,spectroscopi:[2,3,4,5,17,21,25],spectrum:[2,3,4,5,7,8,10,14,17,19,21],spectrumcolorimg:3,speed:2,speedier:2,spetcrum:7,sphinx:[25,26],spinbox:21,spinboxchang:21,spinboxinequalitychang:3,spinboxminmaxset:21,sponaten:[4,5],sqrt:[4,21],squar:[2,4,5,17,19,21],squash:[25,26],stabil:[17,18,25],stabilit:2,standard:[2,3,7,18,21,25,28,29],star:21,starck:[17,18],start:[2,7,11,13,17,21,23],startnum:21,state:[17,21,23,25,28],statutori:25,std:[2,7,21],std_nd_to_1d:23,stddev:21,stdout:11,step:[2,7,21,23,26],stepbi:21,stitch:21,stoke:[2,3,4,5,17,21,25],stop:[2,7,23],str:[3,7,10,11,13,15,17,21,23],string:[7,11,12,13,21],structur:2,sub:[2,4,10,21],sub_asym_list:21,sub_w_list:21,subclass:[10,17,23],subdark:3,subgui:11,subject:[25,28],submain:21,submit:21,submodul:29,subnrb:21,subpackag:29,subract:2,subrang:21,subresidu:3,subsampl:[2,9],subsect:21,subtract:[3,7,15,16,17,21,25],subtract_baselin:[3,29],subtract_dark:[3,29],subtract_mean:[3,29],subtractbaselin:17,subtractdark:17,subtractmeanoverrang:17,subtractroistart:3,subui:21,subuisvd:21,success:[3,10,17],suffix:21,sum:[2,21],summat:[15,16],sun:21,superced:21,support:21,suppress:15,supress:15,sure:[7,11],sustain:25,sv:[17,21],svd:[3,17,21,25],svddecompos:17,svdrecompos:17,system:[2,4,10,21,25,26],t:[2,3,4,5,17,21,25,26],tab:[2,3],tabl:[5,26],tabmainchang:3,take:[2,4,5,7,15,23],tamper:18,task:2,tear:[8,12,14,16,19],technolog:[18,25,28],term:[4,21],termin:21,test2:30,test:[3,4,7,10,11,15,17,23,25,26,30],test_2d_uniform_obj:8,test_2dbasic_redux_rng:19,test_2dbasic_transform_redux_rng:19,test_3d_crop_transpose_flip:8,test_3d_crop_transpose_flips_2:8,test_3d_uniform_obj:8,test_add:16,test_al:[3,17],test_alt:[10,11],test_anscomb:[3,17],test_attr_alt:12,test_attr_alter_sam:12,test_bas:[6,19],test_baseline_sub:[3,17],test_basic2d:6,test_basic3d:6,test_basic_redux:19,test_basic_redux_rng:19,test_basic_rng:19,test_basic_transform:6,test_big_to_small_2d:8,test_big_to_small_2d_2:8,test_big_to_small_3d:8,test_big_to_small_3d_2:8,test_big_to_small_3d_output_given:8,test_big_to_small_3d_output_given_crop:8,test_big_to_small_3d_output_given_crop_transpose_flip:8,test_blank:8,test_breadcrumb:[3,23],test_breadcrumb_offset:24,test_calc_ansc_param:19,test_check_type_compat:12,test_creat:[10,11],test_crop:[3,17],test_crop_2d:8,test_crop_3d:8,test_cut_every_n_spectra:19,test_data_index:[3,7],test_divid:16,test_err_wrong_dim:8,test_err_wrong_dim_append:8,test_fid_or_file_close_if_not_fid:12,test_fid_or_file_fid_provid:12,test_fid_or_file_filename_provid:12,test_filter_list:12,test_fix_end:[6,19],test_fix_rng:[6,19],test_fullpath:12,test_gener:[3,23],test_get_datasets_fullpath:12,test_get_datasets_nopath:12,test_get_dset_attr:12,test_get_group:12,test_get_hierarchy_fullpath:12,test_get_hierarchy_grp_w_dset:12,test_get_hierarchy_nopath:12,test_hdf2:8,test_hdf5:[3,10],test_hdf_import_hsi_to_hsi:14,test_hdf_import_no_output_cls_given:14,test_hdf_import_spectra_to_spectra:14,test_hdf_import_spectrum_to_spectrum:14,test_hdf_is_open:12,test_hilbert:[3,4],test_hilbert_in_plac:6,test_hilbert_no_pad:6,test_hilbert_pad:6,test_hilbert_replace_min_valu:6,test_hsi:[3,7],test_hsi_to_hsi:8,test_hsi_to_hsi_rng:8,test_hsi_to_spectra:8,test_hsi_to_spectra_rng:8,test_hsi_to_spectrum:8,test_hsi_to_spectrum_rng:8,test_inspect:[10,11],test_kk:[3,4],test_kk_3d:6,test_kk_alg:[3,4],test_kk_conjug:6,test_kk_no_bg_norm:6,test_kk_properties_read:6,test_kk_properties_sett:6,test_kk_rng:6,test_kk_transform:6,test_kk_transform_fail:6,test_max:16,test_max_unord:16,test_maxab:16,test_mean_axes_stat:8,test_measur:[3,15],test_measurements_complex:[3,15],test_merge_nrb:[3,4],test_min:16,test_min_unord:16,test_minab:16,test_mosa:[3,7],test_mosaic_hdf:[3,7],test_multipli:16,test_nonh5util:[10,11],test_pad_1d:24,test_pad_1d_0_width:24,test_pad_2d:24,test_pad_2d_0_width:24,test_pad_dual_1d:24,test_pad_dual_1d_all_0:24,test_pad_dual_2d:24,test_pad_edge_mean:[3,23],test_pbt:16,test_peak:16,test_peakfind:[3,15],test_pec:[3,4],test_reshape_axes_stat:8,test_return_family_typ:12,test_rng:6,test_rng_redux2d:6,test_rng_redux3d:6,test_rng_redux:6,test_rng_redux_fix_rng:19,test_rng_redux_fix_rng_vecasym:19,test_save_diff_path:12,test_save_no_attr:12,test_save_to_open_h5_fil:12,test_save_to_open_wrong_typ:12,test_sec:[3,4],test_spectra:[3,7],test_spectra_to_hsi:8,test_spectra_to_hsi_rng:8,test_spectra_to_spectra:8,test_spectra_to_spectra_rng:8,test_spectra_to_spectrum:8,test_spectra_to_spectrum_rng:8,test_spectrum:[3,7],test_spectrum_to_hsi:8,test_spectrum_to_hsi_rng:8,test_spectrum_to_spectra:8,test_spectrum_to_spectra_rng:8,test_spectrum_to_spectrum:8,test_spectrum_to_spectrum_rng:8,test_sub_hsi_from_hsi:19,test_sub_hsi_from_spectra:19,test_sub_hsi_from_spectrum:19,test_sub_hsi_int_from_hsi_float:19,test_sub_spectra_from_hsi:19,test_sub_spectra_from_spectra:19,test_sub_spectra_from_spectrum:19,test_sub_spectrum_from_hsi:19,test_sub_spectrum_from_spectra:19,test_sub_spectrum_from_spectrum:19,test_subtract:16,test_subtract_dark:[3,17],test_sum:16,test_sum_abs_re_im:16,test_sum_re_im:16,test_sum_unord:16,test_transform_incompatible_dtyp:19,test_transform_rng:6,test_ui:[10,11],test_ui_attr:12,test_ui_change_grp_and_filter_exclud:12,test_ui_change_grp_and_filter_includ:12,test_ui_load_fil:12,test_ui_win_title_empty_load_dataset:12,test_ui_win_title_load_dataset:12,test_ui_wrongfil:12,test_util:[10,11],test_valid_dset:12,test_valid_fil:12,test_vec_asym_param:19,test_vec_asym_param_rng_redux:19,test_write_attr_dict:12,test_zero_col_first_col:19,test_zero_col_last_col:19,test_zero_row_first_row:19,test_zero_row_last_row:19,testui:12,text:21,textfromvalu:21,th:17,than:[2,3,4,10,21],thei:7,them:25,thi:[1,2,3,4,5,7,8,17,18,21,23,25,26,28],thin:21,thing:[2,7,15,25],tho:3,those:[1,2,7,21],though:2,three:[2,5],through:[2,3],thru:[11,25],thu:[2,10,11,17,21,25,26],time:[2,4,5,17,21],tip:[17,18],tissu:2,titl:[12,13,21,25,28],to_find:23,to_open:21,todo:7,tool:[2,3,21,25],toolbar:3,toolbarset:3,toolbarsetup:3,toolkit:29,tort:25,total:[2,7],tr1:15,tr2:15,track:3,tradit:2,tran:[2,17,18],transfer:28,transform:[3,4,5,6,16,17,18,19,21,25,29],translat:18,transpos:[8,17],transpose_arr:21,treat:15,trend:2,triangl:21,trough:[2,15,16,21],tue:[7,17],tune:2,tupl:[7,11,13,21,23],tut:18,tutori:2,tuusula:18,two:[4,5,15],type:[4,5,7,10,11,12,13,15,17,18,21,23],typeerror:19,typic:2,u:[17,21],ui:[2,3,10,11,26,29],ui_chang:21,ui_dialog:13,um:[4,5,7],un:21,unbias:[2,17,18],uncalibr:21,uncheck:2,under:[2,26],undo:[3,23],unexpect:25,unfortun:2,uniform:[2,7],uninstal:[25,26],uniqu:23,unit:[3,7,21,22,25,28],uniti:18,unitshap:7,unitshape_orig:7,univers:[17,18],unless:26,unlik:2,unpublish:2,unselect:21,unselected_factor:21,until:[23,25,26],unusu:2,up:[2,3,7,8,21,23],updat:[3,7,21],update_calib_from_data:7,update_data_from_calib:7,updatecurrentremaind:21,updatedataset:21,updatefrequ:21,updatehistori:3,updateinputvalu:21,updatemosaicimag:21,updateoutputvalu:21,updateoverlai:3,updateparam:21,updateplot:21,updateslid:21,upon:25,upper:2,us:[2,3,4,5,6,7,10,11,15,16,17,18,19,21,23,25,26,28],usabl:7,usag:29,use_imag:[17,21],use_prev:18,user:[1,2,3,13],utf:11,util:[2,3,10,12,15,21,25,29],uva:2,v1:[25,26],v:[8,17,21],val1:23,val2:23,valid:[11,12,21],valid_dset:11,valid_fil:11,valid_float_str:21,valu:[3,4,5,7,10,11,12,15,17,21,23,25],valuefromtext:21,vandenabeel:2,var1:23,var2:23,vari:2,variabl:[7,21,23],variabledict:21,varianc:[17,18,25],vec:7,vector:[2,7,9,21,22,23],verbos:[4,11,15,18,21],veri:[7,21],version:[2,21,22,23,25,26],vert:[21,23],vertex:[2,3],vertic:[2,22,23],verts_to_path:23,verts_to_points_in_roi:23,vh:[17,21],vi:11,via:[4,5,11,13,21,25],view:[3,21,25],viewer:12,visgentuil:21,visibl:2,visual:[3,25],vol:18,volum:2,volumetr:2,w:[2,11,21,25,26],wa:[10,11,12,17,25,28],wai:[3,25,26],walk:25,walker:2,warranti:25,water:2,wavelength:[2,7],wavelet:15,wavenumb:[2,3,4,5,7,21],wavenumber_increas:[4,21],we:[2,21],web:26,wed:[4,10,21,23],weight:[4,17,21],weight_sub_val_chang:21,weighted_mean_alpha:17,weightspinboxchang:21,well:3,were:[13,21,23,28],what:[2,7],whatsoev:28,when:[2,7,14,19,24],where:[7,11,12,15,18,21],wherein:2,whether:[7,10,11,12,17,25],which:[2,5,7,17,23],whichev:21,white:2,whittak:21,widget:3,widget_:[3,29],widget_arpl:[3,29],widget_calibr:[3,29],widget_chang:21,widget_cut_every_n_spectra:[3,29],widget_detrend:[3,29],widget_imag:[3,29],widget_jupyt:[3,29],widget_kk:[3,29],widget_mergenrb:[3,29],widget_scientificspin:[3,29],widget_sg:[3,29],widgetarpl:21,widgetbwimg:21,widgetcalibr:21,widgetcolormath:21,widgetcolormod:21,widgetcompositecolor:21,widgetcuteverynspectra:21,widgetdemoploteffectplugin:21,widgetdetrend:21,widgetgrayscaleinfobar:21,widgetimagegainmath:21,widgetkk:21,widgetmergenrb:21,widgetoptionschang:21,widgetpopspectrumg:21,widgetsg:21,widgetsglcolor:21,width:[2,15,21],win_siz:4,window:[2,3,21,23],window_length:21,winext:21,winpython:[25,26],wish:25,within:[2,7,21,23,25,26],without:[8,25,26],wl0:7,wl:7,wl_vec:7,wn:[2,7,9],wn_switchpt:21,wn_vec:[7,21],wnchang:21,won:26,work:[11,23,25,26],workflow:25,workshop:18,would:[2,7],wrap:17,wrapper:23,write:[5,11,12],write_attr_dict:11,written:[7,23],wrong:16,wv:15,wv_width:15,www:[2,18,25,26],x:[2,3,6,7,9,11,15,16,17,21,22,23,30],x_label:[3,21,30],x_pix:7,x_rep:7,x_unit:[3,30],xlen:21,xmax:7,xmin:7,xpix:21,xunit:21,xvec:[22,23],y:[2,3,4,5,7,9,15,17,21,22,23,25,30],y_label:[3,21,30],y_pad:23,y_pix:7,y_rep:7,y_unit:[3,30],yellow:[2,21],yet:7,ylen:21,ymax:7,ymin:7,you:[2,4,5,25,26],your:[2,4,5,25,26],ypix:21,yunit:21,yvec:[22,23],zanran_storag:2,zero:[3,17,23],zero_col:17,zero_row:17,zerocolumn:17,zerofirstcolumn:3,zerofirstrow:3,zerolastcolumn:3,zerolastrow:3,zerorow:17,zoom:[2,7]},titles:["Command Line Tools & Algorithms","API Reference","Walk-Thru: CRI Processing","crikit package","crikit.cri package","crikit.cri.algorithms package","crikit.cri.tests package","crikit.data package","crikit.data.tests package","crikit.datasets package","crikit.io package","crikit.io.lazy5 package","crikit.io.lazy5.tests package","crikit.io.lazy5.ui package","crikit.io.tests package","crikit.measurement package","crikit.measurement.tests package","crikit.preprocess package","crikit.preprocess.algorithms package","crikit.preprocess.tests package","crikit.transform package","crikit.ui package","crikit.ui.utils package","crikit.utils package","crikit.utils.tests package","CRIKit2: Hyperspectral imaging toolkit","Installation Information","Input/Output (IO) Interfaces for CRIkit2","License","CRIkit2","Running the CRIkit2 Graphical User Interface"],titleterms:{"1":[25,26],"10":[25,26],"2":[25,26],"3":[25,26],"4":[25,26],"5":[25,26],"7":[25,26],"class":[1,21,23],"function":1,"import":[25,26],"static":[25,26],As:30,For:[25,26],The:2,abstract_:18,action:2,al:18,algorithm:[0,5,18],alter:11,an:2,anscomb:[2,18],api:1,arpl:18,author:3,avail:[25,26],bcar:2,breadcrumb:23,build:[25,26],built:2,calibr:2,check_requir:22,citat:25,classes_ui:21,clone:26,coher:1,color:2,command:0,config:11,contact:25,contain:1,content:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],copi:[25,26],correct:2,creat:11,cri:[1,2,4,5,6,22],crikit2:[3,25,26,27,29,30],crikit:[1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],crikitui:3,crop:17,csv_nist:10,dark:2,data:[1,7,8,13],datacheck:23,dataset:[2,9],decomposit:2,denois:[2,17],depend:[25,26],develop:25,dialog:21,dialog_abstractfactor:21,dialog_abstractploteffect:21,dialog_anscombeparam:21,dialog_kkopt:21,dialog_model:21,dialog_ploteffect:21,dialog_sav:21,dialog_subresidualopt:21,dialog_svd:21,dialog_varstabanscombeopt:21,document:[25,26],dynam:[25,26],easili:25,error:2,error_correct:4,factor:7,fftspatialnois:15,file:2,frequenc:7,from:[2,30],gener:[2,22,23],git:25,graphic:30,h5loadgui:13,hdf5:[10,13],hdf:2,helper_plotopt:21,helper_roiselect:21,high:[25,26],hsi:2,hyperspectr:[3,25],imag:[3,25],imageri:[1,2],indic:25,inform:26,input:[1,27],inspect:11,instal:[25,26],interest:2,interfac:[21,27,30],invers:2,io:[1,10,11,12,13,14,27],ipython:30,issu:[25,26],jupyt:30,kk:[4,5],known:[25,26],kramer:[2,5],kronig:[2,5],lazy5:[11,12,13],licens:[25,28],line:0,load:[2,13],macro:10,main_mosa:21,math:5,measur:[1,15,16],merg:2,merge_nrb:4,meta_config:10,meta_process:10,method:23,model:9,modul:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,30],monitor:[25,26],mosaic:7,nonh5util:11,normal:2,nrb:2,nuanc:25,numer:2,oper:25,option:[2,25,26],output:[1,27],overview:2,packag:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],peakamp:15,peakfind:15,phantom:2,phase:[2,5],pip:[25,26],preprocess:[1,17,18,19],process:[2,5,22],pseudo:2,pyqt:[25,26],python:[25,26,30],qdialog:13,qt_hdfload:13,qthdfload:13,raman:[1,2],re:[25,26],refer:[1,2],region:2,relat:[2,5],replic:7,residu:2,resolut:[25,26],retriev:[2,5],roi:[2,22,23],run:30,save:[2,21],scale:2,shell:30,singular:2,skip:2,spectra:[2,7],spectral:22,stabil:2,standard:17,start:25,subgui:13,submodul:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24],subpackag:[3,4,7,10,11,15,17,21,23],subtract:2,subtract_baselin:17,subtract_dark:17,subtract_mean:17,svd:2,tabl:25,test:[6,8,12,14,16,19,24],test_al:19,test_alt:12,test_anscomb:19,test_baseline_sub:19,test_breadcrumb:24,test_creat:12,test_crop:19,test_data_index:8,test_gener:24,test_hdf5:14,test_hilbert:6,test_hsi:8,test_inspect:12,test_kk:6,test_kk_alg:6,test_measur:16,test_measurements_complex:16,test_merge_nrb:6,test_mosa:8,test_mosaic_hdf:8,test_nonh5util:12,test_pad_edge_mean:24,test_peakfind:16,test_pec:6,test_sec:6,test_spectra:8,test_spectrum:8,test_subtract_dark:19,test_ui:12,test_util:12,through:[25,26],thru:2,tool:[0,22],toolkit:[3,25],transform:[2,20],two:2,ui:[13,21,22,25],updat:[25,26],usag:3,user:[21,25,30],util:[1,11,22,23,24],valu:2,varianc:2,vi:13,via:[2,26],view:2,visgentuil:22,visual:[21,22],walk:2,widget:21,widget_:21,widget_arpl:21,widget_calibr:21,widget_cut_every_n_spectra:21,widget_detrend:21,widget_imag:21,widget_jupyt:21,widget_kk:21,widget_mergenrb:21,widget_scientificspin:21,widget_sg:21,window:[25,26],within:30,workflow:2}}) \ No newline at end of file diff --git a/docs/source/crikit.data.rst b/docs/source/crikit.data.rst index c4ebb65..39179e8 100644 --- a/docs/source/crikit.data.rst +++ b/docs/source/crikit.data.rst @@ -28,14 +28,6 @@ crikit.data.frequency module :undoc-members: :show-inheritance: -crikit.data.hsi module ----------------------- - -.. automodule:: crikit.data.hsi - :members: - :undoc-members: - :show-inheritance: - crikit.data.mosaic module ------------------------- @@ -60,14 +52,6 @@ crikit.data.spectra module :undoc-members: :show-inheritance: -crikit.data.spectrum module ---------------------------- - -.. automodule:: crikit.data.spectrum - :members: - :undoc-members: - :show-inheritance: - Module contents --------------- diff --git a/docs/source/crikit.io.lazy5.rst b/docs/source/crikit.io.lazy5.rst new file mode 100644 index 0000000..f50b332 --- /dev/null +++ b/docs/source/crikit.io.lazy5.rst @@ -0,0 +1,70 @@ +crikit.io.lazy5 package +======================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit.io.lazy5.tests + crikit.io.lazy5.ui + +Submodules +---------- + +crikit.io.lazy5.alter module +---------------------------- + +.. automodule:: crikit.io.lazy5.alter + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.config module +----------------------------- + +.. automodule:: crikit.io.lazy5.config + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.create module +----------------------------- + +.. automodule:: crikit.io.lazy5.create + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.inspect module +------------------------------ + +.. automodule:: crikit.io.lazy5.inspect + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.nonh5utils module +--------------------------------- + +.. automodule:: crikit.io.lazy5.nonh5utils + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.utils module +---------------------------- + +.. automodule:: crikit.io.lazy5.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5 + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/crikit.io.lazy5.tests.rst b/docs/source/crikit.io.lazy5.tests.rst new file mode 100644 index 0000000..1b29cc8 --- /dev/null +++ b/docs/source/crikit.io.lazy5.tests.rst @@ -0,0 +1,61 @@ +crikit.io.lazy5.tests package +============================= + +Submodules +---------- + +crikit.io.lazy5.tests.test\_alter module +---------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_alter + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_create module +----------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_create + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_inspect module +------------------------------------------ + +.. automodule:: crikit.io.lazy5.tests.test_inspect + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_nonh5utils module +--------------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_nonh5utils + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_ui module +------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_ui + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.tests.test\_utils module +---------------------------------------- + +.. automodule:: crikit.io.lazy5.tests.test_utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5.tests + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/crikit.io.lazy5.ui.rst b/docs/source/crikit.io.lazy5.ui.rst new file mode 100644 index 0000000..4828b93 --- /dev/null +++ b/docs/source/crikit.io.lazy5.ui.rst @@ -0,0 +1,29 @@ +crikit.io.lazy5.ui package +========================== + +Submodules +---------- + +crikit.io.lazy5.ui.QtHdfLoad module +----------------------------------- + +.. automodule:: crikit.io.lazy5.ui.QtHdfLoad + :members: + :undoc-members: + :show-inheritance: + +crikit.io.lazy5.ui.qt\_HdfLoad module +------------------------------------- + +.. automodule:: crikit.io.lazy5.ui.qt_HdfLoad + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit.io.lazy5.ui + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/crikit.io.rst b/docs/source/crikit.io.rst index c4f9734..c2765b7 100644 --- a/docs/source/crikit.io.rst +++ b/docs/source/crikit.io.rst @@ -7,6 +7,7 @@ Subpackages .. toctree:: :maxdepth: 4 + crikit.io.lazy5 crikit.io.tests Submodules diff --git a/docs/source/index.rst b/docs/source/index.rst index 15544f5..7f24a21 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -74,7 +74,6 @@ packages may work. - NumPy - PyQT5 - CVXOPT -- LazyHDF5 >= 0.2.2 - Requires H5Py (>= 2.6) diff --git a/docs/source/installing.rst b/docs/source/installing.rst index c2ff9bf..e97584f 100644 --- a/docs/source/installing.rst +++ b/docs/source/installing.rst @@ -29,7 +29,6 @@ packages may work. - PyQT5 - CVXOPT -- LazyHDF5 >= 0.2.2 - Requires H5Py (>= 2.6) diff --git a/docs/sphinx-apidoc-run.bat b/docs/sphinx-apidoc-run.bat new file mode 100644 index 0000000..54112bf --- /dev/null +++ b/docs/sphinx-apidoc-run.bat @@ -0,0 +1,9 @@ +call make.bat clean + +REM From crikit/docs directory +REM Build API w/o pyuic5-generated files +call sphinx-apidoc.exe -f -o ./source/ ../ ../crikit/ui/qt_* ../crikit/ui/*_rc* ../crikit/ui/old/** ../setup.py + +REM make html +REM On Windows +call make.bat html \ No newline at end of file diff --git a/docs/sphinx-apidoc-run.sh b/docs/sphinx-apidoc-run.sh deleted file mode 100644 index beed92e..0000000 --- a/docs/sphinx-apidoc-run.sh +++ /dev/null @@ -1,9 +0,0 @@ -./make.bat clean - -# From crikit/docs directory -# Build API w/o pyuic5-generated files -sphinx-apidoc.exe -f -o ./source/ ../ ../crikit/ui/qt_* ../crikit/ui/*_rc* ../crikit/ui/old/** ../setup.py - -# make html -# On Windows -./make.bat html \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 077fd73..9bbc95f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,3 @@ numpy scipy cvxopt h5py -LazyHDF5 diff --git a/setup.py b/setup.py index 117fedf..686a727 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ zip_safe = False, include_package_data = True, install_requires=['numpy','matplotlib','scipy','sciplot-pyqt>=0.2.2', - 'cvxopt','LazyHDF5>=0.3.0','packaging'], + 'cvxopt','packaging'], classifiers=['Development Status :: 2 - Pre-Alpha', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', diff --git a/source/EndmemberExtraction.rst b/source/EndmemberExtraction.rst new file mode 100644 index 0000000..84ff289 --- /dev/null +++ b/source/EndmemberExtraction.rst @@ -0,0 +1,101 @@ +EndmemberExtraction package +=========================== + +Submodules +---------- + +EndmemberExtraction.affine\_project module +------------------------------------------ + +.. automodule:: EndmemberExtraction.affine_project + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.mvcnmf module +--------------------------------- + +.. automodule:: EndmemberExtraction.mvcnmf + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.nfindr module +--------------------------------- + +.. automodule:: EndmemberExtraction.nfindr + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.nmf\_tinker module +-------------------------------------- + +.. automodule:: EndmemberExtraction.nmf_tinker + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.sisal module +-------------------------------- + +.. automodule:: EndmemberExtraction.sisal + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.temp\_compare module +---------------------------------------- + +.. automodule:: EndmemberExtraction.temp_compare + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.tinker module +--------------------------------- + +.. automodule:: EndmemberExtraction.tinker + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.tinker2 module +---------------------------------- + +.. automodule:: EndmemberExtraction.tinker2 + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.utils module +-------------------------------- + +.. automodule:: EndmemberExtraction.utils + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.vca\_old module +----------------------------------- + +.. automodule:: EndmemberExtraction.vca_old + :members: + :undoc-members: + :show-inheritance: + +EndmemberExtraction.vca\_v3 module +---------------------------------- + +.. automodule:: EndmemberExtraction.vca_v3 + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: EndmemberExtraction + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.data.rst b/source/crikit2_skunkworks.crikit2_sw.data.rst new file mode 100644 index 0000000..c9bc0fd --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.data.rst @@ -0,0 +1,29 @@ +crikit2\_skunkworks.crikit2\_sw.data package +============================================ + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.data.collection module +------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.data.collection + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.data.ooc module +----------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.data.ooc + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.data + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.io.rst b/source/crikit2_skunkworks.crikit2_sw.io.rst new file mode 100644 index 0000000..6d5bdf5 --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.io.rst @@ -0,0 +1,45 @@ +crikit2\_skunkworks.crikit2\_sw.io package +========================================== + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.io.abstract\_mosaic module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.io.abstract_mosaic + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.io.dask\_hdf5 module +---------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.io.dask_hdf5 + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.io.mosaic\_hdf5 module +------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.io.mosaic_hdf5 + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.io.ooc\_hdf\_import module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.io.ooc_hdf_import + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.io + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.measure.geary.rst b/source/crikit2_skunkworks.crikit2_sw.measure.geary.rst new file mode 100644 index 0000000..4e787eb --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.measure.geary.rst @@ -0,0 +1,45 @@ +crikit2\_skunkworks.crikit2\_sw.measure.geary package +===================================================== + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.measure.geary.cygeary module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.geary.cygeary + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.geary.cygeary module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.geary.cygeary + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.geary.geary module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.geary.geary + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.geary.geary module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.geary.geary + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.geary + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.measure.moran.rst b/source/crikit2_skunkworks.crikit2_sw.measure.moran.rst new file mode 100644 index 0000000..7f32988 --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.measure.moran.rst @@ -0,0 +1,45 @@ +crikit2\_skunkworks.crikit2\_sw.measure.moran package +===================================================== + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.measure.moran.cymoran module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.moran.cymoran + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.moran.cymoran module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.moran.cymoran + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.moran.moran module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.moran.moran + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.measure.moran.moran module +---------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.moran.moran + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure.moran + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.measure.rst b/source/crikit2_skunkworks.crikit2_sw.measure.rst new file mode 100644 index 0000000..edbb2d2 --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.measure.rst @@ -0,0 +1,19 @@ +crikit2\_skunkworks.crikit2\_sw.measure package +=============================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit2_skunkworks.crikit2_sw.measure.geary + crikit2_skunkworks.crikit2_sw.measure.moran + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.measure + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.preprocess.algorithms.rst b/source/crikit2_skunkworks.crikit2_sw.preprocess.algorithms.rst new file mode 100644 index 0000000..f04756c --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.preprocess.algorithms.rst @@ -0,0 +1,37 @@ +crikit2\_skunkworks.crikit2\_sw.preprocess.algorithms package +============================================================= + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.preprocess.algorithms.abstract\_als module +-------------------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.algorithms.abstract_als + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.preprocess.algorithms.als module +---------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.algorithms.als + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.preprocess.algorithms.arpls module +------------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.algorithms.arpls + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.algorithms + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.preprocess.rst b/source/crikit2_skunkworks.crikit2_sw.preprocess.rst new file mode 100644 index 0000000..ce28bfb --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.preprocess.rst @@ -0,0 +1,37 @@ +crikit2\_skunkworks.crikit2\_sw.preprocess package +================================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit2_skunkworks.crikit2_sw.preprocess.algorithms + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.preprocess.Automation module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.Automation + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.preprocess.FeatureSelectors module +------------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess.FeatureSelectors + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.preprocess + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.rst b/source/crikit2_skunkworks.crikit2_sw.rst new file mode 100644 index 0000000..c6548c3 --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.rst @@ -0,0 +1,33 @@ +crikit2\_skunkworks.crikit2\_sw package +======================================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit2_skunkworks.crikit2_sw.data + crikit2_skunkworks.crikit2_sw.io + crikit2_skunkworks.crikit2_sw.measure + crikit2_skunkworks.crikit2_sw.preprocess + crikit2_skunkworks.crikit2_sw.ui + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.qt\_PlotEffect module +----------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.qt_PlotEffect + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.crikit2_sw.ui.rst b/source/crikit2_skunkworks.crikit2_sw.ui.rst new file mode 100644 index 0000000..d3e6368 --- /dev/null +++ b/source/crikit2_skunkworks.crikit2_sw.ui.rst @@ -0,0 +1,165 @@ +crikit2\_skunkworks.crikit2\_sw.ui package +========================================== + +Submodules +---------- + +crikit2\_skunkworks.crikit2\_sw.ui.dialog\_AbstractFactorization module +----------------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.dialog_AbstractFactorization + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.dialog\_AbstractPlotEffect module +-------------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.dialog_AbstractPlotEffect + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.dialog\_SVD module +----------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.dialog_SVD + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.dialog\_ploteffect\_future module +-------------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.dialog_ploteffect_future + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.icons\_all\_rc module +-------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.icons_all_rc + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.icons\_rc module +--------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.icons_rc + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_Factorization module +----------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_Factorization + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_PlotEffect module +-------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_PlotEffect + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_PlotEffect\_ALS module +------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_PlotEffect_ALS + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_PlotEffect\_ArPLS module +--------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_PlotEffect_ArPLS + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_PlotEffect\_DeTrending module +-------------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_PlotEffect_DeTrending + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.qt\_PlotEffect\_KK module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.qt_PlotEffect_KK + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_ALS module +----------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_ALS + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_ArPLS module +------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_ArPLS + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_Calibrate module +----------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_Calibrate + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_DeTrending module +------------------------------------------------------------ + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_DeTrending + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_KK module +---------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_KK + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_SG module +---------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_SG + :members: + :undoc-members: + :show-inheritance: + +crikit2\_skunkworks.crikit2\_sw.ui.widget\_scientificspin module +---------------------------------------------------------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui.widget_scientificspin + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks.crikit2_sw.ui + :members: + :undoc-members: + :show-inheritance: diff --git a/source/crikit2_skunkworks.rst b/source/crikit2_skunkworks.rst new file mode 100644 index 0000000..5485c28 --- /dev/null +++ b/source/crikit2_skunkworks.rst @@ -0,0 +1,29 @@ +crikit2\_skunkworks package +=========================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + crikit2_skunkworks.crikit2_sw + +Submodules +---------- + +crikit2\_skunkworks.setup module +-------------------------------- + +.. automodule:: crikit2_skunkworks.setup + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: crikit2_skunkworks + :members: + :undoc-members: + :show-inheritance: diff --git a/source/modules.rst b/source/modules.rst new file mode 100644 index 0000000..1dc45bd --- /dev/null +++ b/source/modules.rst @@ -0,0 +1,8 @@ +Repos +===== + +.. toctree:: + :maxdepth: 4 + + EndmemberExtraction + crikit2_skunkworks