Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
CCampJr committed Oct 13, 2022
2 parents 64f26c6 + 6e63bc1 commit fd4aecd
Show file tree
Hide file tree
Showing 142 changed files with 457 additions and 424 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This document records all notable changes to
This project adheres to `PEP 440 -- Version Identification
and Dependency Specification <https://www.python.org/dev/peps/pep-0440/>`_.

0.4.4 (22-10-13)
-----------------
- Bug fixes (x- and y-axis vectors failing to generate with imported HDF5 files)
- Minor tweaks and improvements

0.4.3 (22-08-03)
----------------
- Spectrum and Hsi now moved to **data.spectra**. **This could break your fork if you have custom code.**
Expand Down
5 changes: 2 additions & 3 deletions crikit/CRIkitUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,8 @@ def fileOpenSuccess(self, success):
if self.ui.actionUndo_Backup_Enabled.isChecked():
try:
_BCPre.backup_pickle(self.hsi, self.bcpre.id_list[-1])
except Exception as e:
_traceback.print_exc(limit=1)
print(e)
except Exception:
_traceback.print_exc()
print('Error in pickle backup (Undo functionality)')
else:
self.bcpre.backed_up()
Expand Down
2 changes: 1 addition & 1 deletion crikit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* Charles H. Camp Jr. <[email protected]>
"""

__version__ = '0.4.3'
__version__ = '0.4.4'
14 changes: 6 additions & 8 deletions crikit/io/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
__all__ = ['hdf_import_data', 'hdf_import_data_macroraster']


def hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance, config_dict=None):
def hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance, config_dict=None,
interp_kind_spatial='linear', interp_kind_spectral='linear'):
"""
Import dataset(s) from HDF file with each dset being a single line scan.
Expand Down Expand Up @@ -107,10 +108,11 @@ def hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance, c
all_xs.extend(curr_x_vec.tolist())
all_ys.extend([curr_y_pos])

intfcn = interp1d(curr_n_imgs_vec, curr_x_vec, kind='linear')
intfcn = interp1d(curr_n_imgs_vec, curr_x_vec, kind=interp_kind_spatial)

int_fcn_intensity = interp1d(intfcn(np.arange(curr_slice.shape[0])),
curr_slice, axis=0, bounds_error=False, kind='linear', fill_value='extrapolate')
curr_slice, axis=0, bounds_error=False, kind=interp_kind_spectral,
fill_value='extrapolate')

y_idx = find_nearest(y_vec, curr_y_pos)[1]
output_cls_instance.data[y_idx, ...] = int_fcn_intensity(x_vec)
Expand Down Expand Up @@ -169,7 +171,6 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None):
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)
elif isinstance(dset_list, list):
if len(dset_list) > 1:
Expand Down Expand Up @@ -198,9 +199,8 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None):
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][:].astype(dset_dtype_import)

# output_cls_instance.data = fid[dset_list].value
output_cls_instance.meta = lazy5.inspect.get_attrs_dset(fid, dset_list)

elif isinstance(dset_list, list):
Expand All @@ -222,7 +222,6 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None):
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)
elif isinstance(dset_list, list):
if len > 1:
Expand All @@ -249,7 +248,6 @@ def hdf_import_data(pth, filename, dset_list, output_cls_instance=None):
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)
elif isinstance(dset_list, list):
for num, dname in enumerate(dset_list):
Expand Down
6 changes: 4 additions & 2 deletions crikit/io/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
__all__ = ['import_hdf_nist_special', 'import_csv_nist_special1']


def hdf_nist_special_macroraster(pth, filename, dset_list, output_cls_instance):
def hdf_nist_special_macroraster(pth, filename, dset_list, output_cls_instance,
interp_kind_spatial='linear', interp_kind_spectral='linear'):
print('\n')
import_success = _hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance)
import_success = _hdf_import_data_macroraster(pth, filename, dset_list, output_cls_instance,
interp_kind_spatial='linear', interp_kind_spectral='linear')
if import_success is False:
raise ValueError('hdf_import_data_macroraster failed')
return False
Expand Down
15 changes: 15 additions & 0 deletions crikit/io/meta_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,16 @@ def meta_process(rosetta, output_cls_instance):
stop = output_cls_instance.shape[1]-1
units = 'pix'

if isinstance(start, _np.ndarray):
start = start[0]
if isinstance(stop, _np.ndarray):
stop = stop[0]
if isinstance(steps, _np.ndarray):
steps = steps[0]

print('{} ({}): Start={}\tStop={}\tSteps={}'.format(label, units, start, stop, steps))
# print('Start: {}, Stop: {}, Steps: {}'.format(start, stop, steps))

output_cls_instance.x_rep.data = _np.squeeze(_np.linspace(start, stop, steps))
output_cls_instance.x_rep.units = units
output_cls_instance.x_rep.label = label
Expand Down Expand Up @@ -224,6 +232,13 @@ def meta_process(rosetta, output_cls_instance):
if isinstance(label, bytes):
label = label.decode()

if isinstance(start, _np.ndarray):
start = start[0]
if isinstance(stop, _np.ndarray):
stop = stop[0]
if isinstance(steps, _np.ndarray):
steps = steps[0]

if steps != output_cls_instance.shape[0]:
print('{} ({}): Start={}\tStop={}\tSteps={}'.format(label, units, start, stop, steps))
print('Warning: {}Steps assigned in meta data ({}) disagrees with datacube size ({})'.format(label, steps, output_cls_instance.shape[0]))
Expand Down
Binary file modified docs/build/doctrees/crikit.io.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -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: 79acee3da732a2077d4e910c14203444
config: 126e78dc37b63522d8e4d07dce0d2051
tags: 645f666f9bcd5a90fca523b33c5a78b7
11 changes: 5 additions & 6 deletions docs/build/html/_modules/crikit/CRIkitUI.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.CRIkitUI &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.CRIkitUI &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../_static/nature.css" />
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.CRIkitUI</a></li>
</ul>
Expand Down Expand Up @@ -931,9 +931,8 @@ <h1>Source code for crikit.CRIkitUI</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ui</span><span class="o">.</span><span class="n">actionUndo_Backup_Enabled</span><span class="o">.</span><span class="n">isChecked</span><span class="p">():</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">_BCPre</span><span class="o">.</span><span class="n">backup_pickle</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">hsi</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">bcpre</span><span class="o">.</span><span class="n">id_list</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">_traceback</span><span class="o">.</span><span class="n">print_exc</span><span class="p">(</span><span class="n">limit</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">e</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
<span class="n">_traceback</span><span class="o">.</span><span class="n">print_exc</span><span class="p">()</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;Error in pickle backup (Undo functionality)&#39;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">bcpre</span><span class="o">.</span><span class="n">backed_up</span><span class="p">()</span>
Expand Down Expand Up @@ -3908,7 +3907,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.CRIkitUI</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions docs/build/html/_modules/crikit/cri/algorithms/kk.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.cri.algorithms.kk &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.cri.algorithms.kk &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/nature.css" />
<script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.algorithms.kk</a></li>
</ul>
Expand Down Expand Up @@ -274,7 +274,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.algorithms.kk</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions docs/build/html/_modules/crikit/cri/error_correction.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.cri.error_correction &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.cri.error_correction &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/nature.css" />
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.error_correction</a></li>
</ul>
Expand Down Expand Up @@ -355,7 +355,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.error_correction</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions docs/build/html/_modules/crikit/cri/kk.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.cri.kk &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.cri.kk &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/nature.css" />
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.kk</a></li>
</ul>
Expand Down Expand Up @@ -363,7 +363,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.kk</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions docs/build/html/_modules/crikit/cri/merge_nrbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.cri.merge_nrbs &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.cri.merge_nrbs &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/nature.css" />
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.merge_nrbs</a></li>
</ul>
Expand Down Expand Up @@ -175,7 +175,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.merge_nrbs</a></li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions docs/build/html/_modules/crikit/cri/tests/test_hilbert.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>crikit.cri.tests.test_hilbert &#8212; CRIKit2 0.4.3 documentation</title>
<title>crikit.cri.tests.test_hilbert &#8212; CRIKit2 0.4.4 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/nature.css" />
<script data-url_root="../../../../" id="documentation_options" src="../../../../_static/documentation_options.js"></script>
Expand All @@ -24,7 +24,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.tests.test_hilbert</a></li>
</ul>
Expand Down Expand Up @@ -116,7 +116,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">CRIKit2 0.4.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">crikit.cri.tests.test_hilbert</a></li>
</ul>
Expand Down
Loading

0 comments on commit fd4aecd

Please sign in to comment.