Skip to content
Snippets Groups Projects
Commit 2ec6ee84 authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Code cleanup. Instroduced underscore notation for private functions, methods and attributes

parent 9675f57c
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import numpy
_CXISimpleEntry = namedtuple('SimpleEntry', ['path', 'data', 'overwrite'])
class _Stack:
def __init__(self, path, data, axes):
......@@ -47,6 +48,13 @@ class _Stack:
self._path = path
self._axes = axes
def is_there_data_to_write(self):
if self._data_to_write is not None:
return True
else:
return False
def write_initial_slice(self, file_handle, max_num_slices):
file_handle.create_dataset(self._path, shape=(max_num_slices,) + self._data_shape,
......@@ -337,7 +345,7 @@ class CXIWriter:
raise RuntimeError('The file already holds the maximum allowed number of slices, and should be closed')
for entry in self._cxi_stacks.values():
if entry._data_to_write is None:
if entry.is_there_data_to_write is False:
raise RuntimeError('The slice is incomplete and will not be written. The following stack is not '
'present in the current slice:', entry.path)
......@@ -376,4 +384,4 @@ class CXIWriter:
self._fh.close()
self._file_is_open = False
\ No newline at end of file
self._file_is_open = False
......@@ -64,8 +64,8 @@ def read_cbf_from_stream(stream):
if len(cbf_obj.cif[cbf_obj.CIF_BINARY_BLOCK_KEY]) > int(
cbf_obj.header["X-Binary-Size"]) + cbf_obj.start_binary + len(cbf_obj.STARTER):
cbf_obj.cbs = cbf_obj.cif[cbf_obj.CIF_BINARY_BLOCK_KEY][:int(cbf_obj.header["X-Binary-Size"]) +
cbf_obj.start_binary +
len(cbf_obj.STARTER)]
cbf_obj.start_binary +
len(cbf_obj.STARTER)]
else:
cbf_obj.cbs = cbf_obj.cif[cbf_obj.CIF_BINARY_BLOCK_KEY]
binary_data = cbf_obj.cbs[cbf_obj.start_binary + len(cbf_obj.STARTER):]
......
......@@ -460,8 +460,12 @@ def scatterplot_3d(data, color=None, point_size=None, cmap="jet", point_shape=No
color (Optional[numpy.ndimage]): 1D Array of floating points with same length as the data array.
These numbers give the color of each point.
point_size (Optional[float]): The size of each points. Behaves differently depending on the point_shape.
If shape is spheres the size is relative to the scene and if squares the size is relative to the window.
cmap (Optional[str]): Color map
point_shape (Optional["spheres" or "squares"]): "spheres" plots each point as a sphere, recommended for
small data sets. "squares" plot each point as a square without any 3D structure, recommended for
large data sets.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment