Commit 4ddad6f6 authored by Somnath, Suhas's avatar Somnath, Suhas
Browse files

PEP8 renaming of showTree and addChildren

parent 58f4ab39
......@@ -84,13 +84,13 @@ data_group = px.MicroDataGroup('Data_Group', parent='/')
root_group = px.MicroDataGroup('/')
# After creating the group, we then add an existing object as its child.
data_group.addChildren([ds_empty])
root_group.addChildren([ds_main, data_group])
data_group.add_children([ds_empty])
root_group.add_children([ds_main, data_group])
##############################################################################
# The showTree method allows us to view the data structure before the hdf5 file is
# created.
root_group.showTree()
root_group.show_tree()
##############################################################################
# Now that we have created the objects, we can write them to an hdf5 file
......
......@@ -132,8 +132,8 @@ If the group's parent is not given, it will be set to root.
root_group = px.MicroDataGroup('/')
# After creating the group, we then add an existing object as its child.
data_group.addChildren([ds_empty])
root_group.addChildren([ds_main, data_group])
data_group.add_children([ds_empty])
root_group.add_children([ds_main, data_group])
......@@ -141,14 +141,14 @@ If the group's parent is not given, it will be set to root.
The showTree method allows us to view the data structure before the hdf5 file is
The show_tree method allows us to view the data structure before the hdf5 file is
created.
.. code-block:: python
root_group.showTree()
root_group.show_tree()
......
......@@ -344,11 +344,11 @@ print('New group to be created with name:', cluster_grp.name)
print('This group (subtree) will be appended to the H5 file under the group:', subtree_root_path)
# Making a tree structure by adding the MicroDataset objects as children of this group
cluster_grp.addChildren([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
cluster_grp.add_children([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
print('\nWill write the following tree:')
cluster_grp.showTree()
cluster_grp.show_tree()
cluster_grp.attrs['num_clusters'] = num_clusters
cluster_grp.attrs['num_samples'] = h5_main.shape[0]
......
......@@ -462,11 +462,11 @@ operation being performed on the same dataset. The index will then be updated ac
print('This group (subtree) will be appended to the H5 file under the group:', subtree_root_path)
# Making a tree structure by adding the MicroDataset objects as children of this group
cluster_grp.addChildren([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
cluster_grp.add_children([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
print('\nWill write the following tree:')
cluster_grp.showTree()
cluster_grp.show_tree()
cluster_grp.attrs['num_clusters'] = num_clusters
cluster_grp.attrs['num_samples'] = h5_main.shape[0]
......
......@@ -139,7 +139,7 @@ class ShoGuess(px.Process):
dset_name = self.h5_main.name.split('/')[-1]
sho_grp = px.MicroDataGroup('-'.join([dset_name, 'SHO_Fit_']), self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.add_children([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
......
......@@ -157,7 +157,7 @@ Note that:
dset_name = self.h5_main.name.split('/')[-1]
sho_grp = px.MicroDataGroup('-'.join([dset_name, 'SHO_Fit_']), self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.add_children([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
......
......@@ -84,13 +84,13 @@ data_group = px.MicroDataGroup('Data_Group', parent='/')
root_group = px.MicroDataGroup('/')
# After creating the group, we then add an existing object as its child.
data_group.addChildren([ds_empty])
root_group.addChildren([ds_main, data_group])
data_group.add_children([ds_empty])
root_group.add_children([ds_main, data_group])
##############################################################################
# The showTree method allows us to view the data structure before the hdf5 file is
# created.
root_group.showTree()
root_group.show_tree()
##############################################################################
# Now that we have created the objects, we can write them to an hdf5 file
......
......@@ -132,8 +132,8 @@ If the group's parent is not given, it will be set to root.
root_group = px.MicroDataGroup('/')
# After creating the group, we then add an existing object as its child.
data_group.addChildren([ds_empty])
root_group.addChildren([ds_main, data_group])
data_group.add_children([ds_empty])
root_group.add_children([ds_main, data_group])
......@@ -141,14 +141,14 @@ If the group's parent is not given, it will be set to root.
The showTree method allows us to view the data structure before the hdf5 file is
The show_tree method allows us to view the data structure before the hdf5 file is
created.
.. code-block:: python
root_group.showTree()
root_group.show_tree()
......
......@@ -344,11 +344,11 @@ print('New group to be created with name:', cluster_grp.name)
print('This group (subtree) will be appended to the H5 file under the group:', subtree_root_path)
# Making a tree structure by adding the MicroDataset objects as children of this group
cluster_grp.addChildren([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
cluster_grp.add_children([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
print('\nWill write the following tree:')
cluster_grp.showTree()
cluster_grp.show_tree()
cluster_grp.attrs['num_clusters'] = num_clusters
cluster_grp.attrs['num_samples'] = h5_main.shape[0]
......
......@@ -462,11 +462,11 @@ operation being performed on the same dataset. The index will then be updated ac
print('This group (subtree) will be appended to the H5 file under the group:', subtree_root_path)
# Making a tree structure by adding the MicroDataset objects as children of this group
cluster_grp.addChildren([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
cluster_grp.add_children([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
print('\nWill write the following tree:')
cluster_grp.showTree()
cluster_grp.show_tree()
cluster_grp.attrs['num_clusters'] = num_clusters
cluster_grp.attrs['num_samples'] = h5_main.shape[0]
......
......@@ -139,7 +139,7 @@ class ShoGuess(px.Process):
dset_name = self.h5_main.name.split('/')[-1]
sho_grp = px.MicroDataGroup('-'.join([dset_name, 'SHO_Fit_']), self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.add_children([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
......
......@@ -157,7 +157,7 @@ Note that:
dset_name = self.h5_main.name.split('/')[-1]
sho_grp = px.MicroDataGroup('-'.join([dset_name, 'SHO_Fit_']), self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.add_children([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
......
......@@ -90,13 +90,13 @@ data_group = px.MicroDataGroup('Data_Group', parent='/')
root_group = px.MicroDataGroup('/')
# After creating the group, we then add an existing object as its child.
data_group.addChildren([ds_empty])
root_group.addChildren([ds_main, data_group])
data_group.add_children([ds_empty])
root_group.add_children([ds_main, data_group])
##############################################################################
# The showTree method allows us to view the data structure before the hdf5 file is
# created.
root_group.showTree()
root_group.show_tree()
##############################################################################
# Now that we have created the objects, we can write them to an hdf5 file
......
......@@ -343,11 +343,11 @@ print('New group to be created with name:', cluster_grp.name)
print('This group (subtree) will be appended to the H5 file under the group:', subtree_root_path)
# Making a tree structure by adding the MicroDataset objects as children of this group
cluster_grp.addChildren([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
cluster_grp.add_children([ds_label_mat, ds_cluster_centroids, ds_cluster_inds, ds_cluster_vals, ds_labels_spec_inds,
ds_labels_spec_vals])
print('\nWill write the following tree:')
cluster_grp.showTree()
cluster_grp.show_tree()
cluster_grp.attrs['num_clusters'] = num_clusters
cluster_grp.attrs['num_samples'] = h5_main.shape[0]
......
......@@ -139,7 +139,7 @@ class ShoGuess(px.Process):
dset_name = self.h5_main.name.split('/')[-1]
sho_grp = px.MicroDataGroup('-'.join([dset_name, 'SHO_Fit_']), self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.add_children([ds_guess, ds_sho_inds, ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp)
......
......@@ -472,8 +472,8 @@ class BELoopFitter(Fitter):
proj_grp = MicroDataGroup('-'.join([dset_name, 'Loop_Fit_']),
self.h5_main.parent.name[1:])
proj_grp.attrs['projection_method'] = 'pycroscopy BE loop model'
proj_grp.addChildren([ds_projected_loops, ds_loop_metrics,
ds_loop_met_spec_inds, ds_loop_met_spec_vals])
proj_grp.add_children([ds_projected_loops, ds_loop_metrics,
ds_loop_met_spec_inds, ds_loop_met_spec_vals])
h5_proj_grp_refs = self.hdf.writeData(proj_grp)
self.h5_projected_loops = get_h5_obj_refs(['Projected_Loops'], h5_proj_grp_refs)[0]
......
......@@ -82,9 +82,9 @@ class BESHOfitter(Fitter):
sho_grp = MicroDataGroup('-'.join([dset_name,
'SHO_Fit_']),
self.h5_main.parent.name[1:])
sho_grp.addChildren([ds_guess,
ds_sho_inds,
ds_sho_vals])
sho_grp.add_children([ds_guess,
ds_sho_inds,
ds_sho_vals])
sho_grp.attrs['SHO_guess_method'] = "pycroscopy BESHO"
h5_sho_grp_refs = self.hdf.writeData(sho_grp, print_log=self._verbose)
......
......@@ -138,13 +138,13 @@ class GIVBayesian(Process):
bayes_grp = MicroDataGroup(self.h5_main.name.split('/')[-1] + '-' + self.process_name + '_',
parent=self.h5_main.parent.name)
bayes_grp.addChildren([ds_spec_inds, ds_spec_vals, ds_cap, ds_r_var, ds_res, ds_i_corr,
ds_cap_spec_inds, ds_cap_spec_vals])
bayes_grp.add_children([ds_spec_inds, ds_spec_vals, ds_cap, ds_r_var, ds_res, ds_i_corr,
ds_cap_spec_inds, ds_cap_spec_vals])
bayes_grp.attrs = {'algorithm_author': 'Kody J. Law', 'last_pixel': 0}
bayes_grp.attrs.update(self.parms_dict)
if self.verbose:
bayes_grp.showTree()
bayes_grp.show_tree()
self.hdf = ioHDF5(self.h5_main.file)
h5_refs = self.hdf.writeData(bayes_grp, print_log=self.verbose)
......
......@@ -331,7 +331,7 @@ def fit_atom_positions_dset(h5_grp, fitting_parms=None, num_cores=None):
ds_atom_fits = MicroDataset('Fit', data=fit_parms)
dgrp_atom_finding = MicroDataGroup(h5_grp.name.split('/')[-1], parent=h5_grp.parent.name)
dgrp_atom_finding.attrs = fitting_parms
dgrp_atom_finding.addChildren([ds_atom_guesses, ds_atom_fits])
dgrp_atom_finding.add_children([ds_atom_guesses, ds_atom_fits])
hdf = ioHDF5(h5_grp.file)
h5_atom_refs = hdf.writeData(dgrp_atom_finding)
......
......@@ -508,8 +508,8 @@ class Gauss_Fit(object):
data=self.closest_neighbors_mat, dtype=np.uint32)
dgrp_atom_finding = MicroDataGroup(self.atom_grp.name.split('/')[-1], parent=self.atom_grp.parent.name)
dgrp_atom_finding.attrs = self.fitting_parms
dgrp_atom_finding.addChildren([ds_atom_guesses, ds_atom_fits, ds_motif_guesses,
ds_motif_fits, ds_nearest_neighbors])
dgrp_atom_finding.add_children([ds_atom_guesses, ds_atom_fits, ds_motif_guesses,
ds_motif_fits, ds_nearest_neighbors])
hdf = ioHDF5(self.atom_grp.file)
h5_atom_refs = hdf.writeData(dgrp_atom_finding)
......
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