Commit 9e068b40 authored by Somnath, Suhas's avatar Somnath, Suhas
Browse files

moved core components of package to new subpackage core. updated inputs

parent d2ffb76d
......@@ -9,24 +9,24 @@ pycroscopy\.io\.hdf\_utils
.. autosummary::
buildReducedSpec
build_reduced_spec_dsets
calc_chunks
checkAndLinkAncillary
checkIfMain
check_and_link_ancillary
check_if_main
check_for_old
copyAttributes
copyRegionRefs
copy_attributes
copy_region_refs
copy_main_attributes
createRefFromIndices
create_region_reference
create_empty_dataset
create_spec_inds_from_vals
findDataset
findH5group
getAuxData
getDataSet
getH5DsetRefs
getH5GroupRefs
getH5RegRefIndices
find_dataset
find_results_groups
get_auxillary_datasets
get_datasets
get_h5_obj_refs
get_group_refs
get_indices_for_region_ref
get_all_main
get_attr
get_attributes
......@@ -36,14 +36,14 @@ pycroscopy\.io\.hdf\_utils
get_sort_order
get_source_dataset
get_unit_values
linkRefAsAlias
linkRefs
link_h5_obj_as_alias
link_h5_objects_as_attrs
link_as_main
print_tree
reducingRefCopy
reshape_from_Ndims
reshape_to_Ndims
simpleRefCopy
copy_reg_ref_reduced_dim
reshape_from_n_dims
reshape_to_n_dims
simple_region_ref_copy
......
Examples using ``pycroscopy.hdf_utils.buildReducedSpec``
Examples using ``pycroscopy.hdf_utils.build_reduced_spec_dsets``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.checkAndLinkAncillary``
Examples using ``pycroscopy.hdf_utils.check_and_link_ancillary``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.checkIfMain``
Examples using ``pycroscopy.hdf_utils.check_if_main``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.findDataset``
Examples using ``pycroscopy.hdf_utils.find_dataset``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.findH5group``
Examples using ``pycroscopy.hdf_utils.find_results_groups``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.getAuxData``
Examples using ``pycroscopy.hdf_utils.get_auxillary_datasets``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.getDataSet``
Examples using ``pycroscopy.hdf_utils.get_datasets``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.getH5DsetRefs``
Examples using ``pycroscopy.hdf_utils.get_h5_obj_refs``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.linkRefs``
Examples using ``pycroscopy.hdf_utils.link_h5_objects_as_attrs``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.reshape_from_Ndims``
Examples using ``pycroscopy.hdf_utils.reshape_from_n_dims``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.hdf_utils.reshape_to_Ndims``
Examples using ``pycroscopy.hdf_utils.reshape_to_n_dims``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
Examples using ``pycroscopy.io.hdf_utils.getH5DsetRefs``
Examples using ``pycroscopy.io.hdf_utils.get_h5_obj_refs``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. raw:: html
......
......@@ -111,7 +111,7 @@ We will begin by downloading the BE-PFM dataset from Github
h5_main = h5_meas_grp['Channel_000/Raw_Data']
# Extracting the X axis - vector of frequencies
h5_spec_vals = px.hdf_utils.getAuxData(h5_main,'Spectroscopic_Values')[-1]
h5_spec_vals = px.hdf_utils.get_auxillary_datasets(h5_main,'Spectroscopic_Values')[-1]
freq_vec = np.squeeze(h5_spec_vals.value) * 1E-3
print('Data currently of shape:', h5_main.shape)
......
......@@ -193,8 +193,8 @@ new file.
h5_refs = hdf.writeData(root_group, print_log=True)
# We can use these references to get the h5py dataset and group objects
h5_main = px.io.hdf_utils.getH5DsetRefs(['Main_Data'], h5_refs)[0]
h5_empty = px.io.hdf_utils.getH5DsetRefs(['Empty_Data'], h5_refs)[0]
h5_main = px.io.hdf_utils.get_h5_obj_refs(['Main_Data'], h5_refs)[0]
h5_empty = px.io.hdf_utils.get_h5_obj_refs(['Empty_Data'], h5_refs)[0]
......
......@@ -85,6 +85,8 @@ import os
from warnings import warn
# Package for downloading online files:
import pycroscopy.core.io.translator
try:
# This package is not part of anaconda and may need to be installed.
import wget
......@@ -277,9 +279,9 @@ px.plot_utils.plot_cluster_results_together(np.reshape(labels, (num_rows, num_co
#
# In this case, `centroids` has `k` positions all in one dimension. Thus the matrix needs to be reshaped to `k x 1`
ds_labels_spec_inds, ds_labels_spec_vals = px.io.translators.utils.build_ind_val_dsets([1], labels=['Label'])
ds_cluster_inds, ds_cluster_vals = px.io.translators.utils.build_ind_val_dsets([centroids.shape[0]], is_spectral=False,
labels=['Cluster'])
ds_labels_spec_inds, ds_labels_spec_vals = pycroscopy.core.io.translator.build_ind_val_dsets([1], labels=['Label'])
ds_cluster_inds, ds_cluster_vals = pycroscopy.core.io.translator.build_ind_val_dsets([centroids.shape[0]], is_spectral=False,
labels=['Cluster'])
labels_mat = np.uint32(labels.reshape([-1, 1]))
# Rename the datasets
......
......@@ -192,7 +192,7 @@ instead.
y_label = px.hdf_utils.get_attr(h5_main, 'quantity') + ' [' + px.hdf_utils.get_attr(h5_main, 'units') + ']'
# Get the voltage vector that this data was acquired as a function of:
h5_spec_vals = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Values')[0]
h5_spec_vals = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Values')[0]
volt_vec = np.squeeze(h5_spec_vals[()])
# Get the descriptor for this
......@@ -530,12 +530,12 @@ Once the tree is prepared (previous cell), ioHDF5 will handle all the file writi
h5_clust_refs = hdf.writeData(cluster_grp, print_log=True)
h5_labels = px.hdf_utils.getH5DsetRefs(['Labels'], h5_clust_refs)[0]
h5_centroids = px.hdf_utils.getH5DsetRefs(['Mean_Response'], h5_clust_refs)[0]
h5_clust_inds = px.hdf_utils.getH5DsetRefs(['Cluster_Indices'], h5_clust_refs)[0]
h5_clust_vals = px.hdf_utils.getH5DsetRefs(['Cluster_Values'], h5_clust_refs)[0]
h5_label_inds = px.hdf_utils.getH5DsetRefs(['Label_Spectroscopic_Indices'], h5_clust_refs)[0]
h5_label_vals = px.hdf_utils.getH5DsetRefs(['Label_Spectroscopic_Values'], h5_clust_refs)[0]
h5_labels = px.hdf_utils.get_h5_obj_refs(['Labels'], h5_clust_refs)[0]
h5_centroids = px.hdf_utils.get_h5_obj_refs(['Mean_Response'], h5_clust_refs)[0]
h5_clust_inds = px.hdf_utils.get_h5_obj_refs(['Cluster_Indices'], h5_clust_refs)[0]
h5_clust_vals = px.hdf_utils.get_h5_obj_refs(['Cluster_Values'], h5_clust_refs)[0]
h5_label_inds = px.hdf_utils.get_h5_obj_refs(['Label_Spectroscopic_Indices'], h5_clust_refs)[0]
h5_label_vals = px.hdf_utils.get_h5_obj_refs(['Label_Spectroscopic_Values'], h5_clust_refs)[0]
......@@ -653,20 +653,20 @@ rather easy by a few pycroscopy functions.
# we already got the reference to the spectroscopic values in the first few cells
h5_spec_inds = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Indices')[0]
h5_spec_inds = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Indices')[0]
px.hdf_utils.checkAndLinkAncillary(h5_labels,
px.hdf_utils.check_and_link_ancillary(h5_labels,
['Position_Indices', 'Position_Values'],
h5_main=h5_main)
px.hdf_utils.checkAndLinkAncillary(h5_labels,
px.hdf_utils.check_and_link_ancillary(h5_labels,
['Spectroscopic_Indices', 'Spectroscopic_Values'],
anc_refs=[h5_label_inds, h5_label_vals])
px.hdf_utils.checkAndLinkAncillary(h5_centroids,
px.hdf_utils.check_and_link_ancillary(h5_centroids,
['Spectroscopic_Indices', 'Spectroscopic_Values'],
anc_refs=[h5_spec_inds, h5_spec_vals])
px.hdf_utils.checkAndLinkAncillary(h5_centroids,
px.hdf_utils.check_and_link_ancillary(h5_centroids,
['Position_Indices', 'Position_Values'],
anc_refs=[h5_clust_inds, h5_clust_vals])
......
......@@ -191,10 +191,10 @@ slice the data. For that we need the ancillary datasets that support this main d
# pycroscopy has a convenient function to access datasets linked to a given dataset:
h5_spec_ind = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Indices')[0]
h5_spec_val = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Values')[0]
h5_pos_ind = px.hdf_utils.getAuxData(h5_main, 'Position_Indices')[0]
h5_pos_val = px.hdf_utils.getAuxData(h5_main, 'Position_Values')[0]
h5_spec_ind = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Indices')[0]
h5_spec_val = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Values')[0]
h5_pos_ind = px.hdf_utils.get_auxillary_datasets(h5_main, 'Position_Indices')[0]
h5_pos_val = px.hdf_utils.get_auxillary_datasets(h5_main, 'Position_Values')[0]
......@@ -536,7 +536,7 @@ make up this function.
.. code-block:: python
ds_nd, success, labels = px.hdf_utils.reshape_to_Ndims(h5_main, get_labels=True)
ds_nd, success, labels = px.hdf_utils.reshape_to_n_dims(h5_main, get_labels=True)
print('Shape of the N-dimensional dataset:', ds_nd.shape)
print(labels)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -131,7 +131,7 @@ Note that:
super(ShoGuess, self).__init__(h5_main, cores=cores)
# find the frequency vector
h5_spec_vals = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Values')[-1]
h5_spec_vals = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Values')[-1]
self.freq_vec = np.squeeze(h5_spec_vals.value) * 1E-3
def _create_results_datasets(self):
......@@ -140,8 +140,8 @@ Note that:
Just as the raw data is stored in the pycroscopy format, the results also need to conform to the same
standards. Hence, the create_datasets function can appear to be a little longer than one might expect.
"""
h5_spec_inds = px.hdf_utils.getAuxData(self.h5_main, auxDataName=['Spectroscopic_Indices'])[0]
h5_spec_vals = px.hdf_utils.getAuxData(self.h5_main, auxDataName=['Spectroscopic_Values'])[0]
h5_spec_inds = px.hdf_utils.get_auxillary_datasets(self.h5_main, auxDataName=['Spectroscopic_Indices'])[0]
h5_spec_vals = px.hdf_utils.get_auxillary_datasets(self.h5_main, auxDataName=['Spectroscopic_Values'])[0]
self.step_start_inds = np.where(h5_spec_inds[0] == 0)[0]
self.num_udvs_steps = len(self.step_start_inds)
......@@ -152,7 +152,7 @@ Note that:
not_freq = px.hdf_utils.get_attr(h5_spec_inds, 'labels') != 'Frequency'
ds_sho_inds, ds_sho_vals = px.hdf_utils.buildReducedSpec(h5_spec_inds, h5_spec_vals, not_freq,
ds_sho_inds, ds_sho_vals = px.hdf_utils.build_reduced_spec_dsets(h5_spec_inds, h5_spec_vals, not_freq,
self.step_start_inds)
dset_name = self.h5_main.name.split('/')[-1]
......@@ -162,18 +162,18 @@ Note that:
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
self.h5_guess = px.hdf_utils.getH5DsetRefs(['Guess'], h5_sho_grp_refs)[0]
self.h5_guess = px.hdf_utils.get_h5_obj_refs(['Guess'], h5_sho_grp_refs)[0]
self.h5_results_grp = self.h5_guess.parent
h5_sho_inds = px.hdf_utils.getH5DsetRefs(['Spectroscopic_Indices'],
h5_sho_inds = px.hdf_utils.get_h5_obj_refs(['Spectroscopic_Indices'],
h5_sho_grp_refs)[0]
h5_sho_vals = px.hdf_utils.getH5DsetRefs(['Spectroscopic_Values'],
h5_sho_vals = px.hdf_utils.get_h5_obj_refs(['Spectroscopic_Values'],
h5_sho_grp_refs)[0]
# Reference linking before actual fitting
px.hdf_utils.linkRefs(self.h5_guess, [h5_sho_inds, h5_sho_vals])
px.hdf_utils.link_h5_objects_as_attrs(self.h5_guess, [h5_sho_inds, h5_sho_vals])
# Linking ancillary position datasets:
aux_dsets = px.hdf_utils.getAuxData(self.h5_main, auxDataName=['Position_Indices', 'Position_Values'])
px.hdf_utils.linkRefs(self.h5_guess, aux_dsets)
aux_dsets = px.hdf_utils.get_auxillary_datasets(self.h5_main, auxDataName=['Position_Indices', 'Position_Values'])
px.hdf_utils.link_h5_objects_as_attrs(self.h5_guess, aux_dsets)
print('Finshed creating datasets')
def compute(self, *args, **kwargs):
......@@ -258,7 +258,7 @@ dimensional matrix in accordance with the pycroscopy data format.
h5_main = h5_meas_grp['Channel_000/Raw_Data']
# Extracting the X axis - vector of frequencies
h5_spec_vals = px.hdf_utils.getAuxData(h5_main, 'Spectroscopic_Values')[-1]
h5_spec_vals = px.hdf_utils.get_auxillary_datasets(h5_main, 'Spectroscopic_Values')[-1]
freq_vec = np.squeeze(h5_spec_vals.value) * 1E-3
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment