Commit 6d1855cf authored by Thomas Vincent's avatar Thomas Vincent

code style

parent fde20af5
......@@ -56,16 +56,14 @@ class BackgroundTypes(object):
class PeakFitter(Thread):
"""
:param qspace_f: path to the HDF5 file containing the qspace cubes
:type data_h5f: `str`
:param str qspace_f: path to the HDF5 file containing the qspace cubes
:param fit_type:
:type img_indices: *optional*
:param FitTypes fit_type:
:param indices: indices of the cubes (in the input HDF5 dataset) for which
the qx/qy/qz peaks coordinates will be computed. E.g : if the array
[1, 2, 3] is provided, only those cubes will be fitted.
:type img_indices: *optional* `array_like`
:type indices: *optional* `array_like`
:param Union[int,None] n_proc:
Number of process to use. If None, the config value is used.
......@@ -213,6 +211,8 @@ class PeakFitter(Thread):
n_peaks = n_peaks if n_peaks >= 1 else 1
shared_results = SilxResults(n_points=n_indices,
n_peaks=n_peaks)
else:
raise RuntimeError('Unknown Fit Type')
# with h5py.File(qspace_f, 'r') as qspace_h5:
#
......@@ -262,7 +262,7 @@ class PeakFitter(Thread):
self.__background))
if disp_times:
class myTimes(object):
class MyTimes(object):
def __init__(self):
self.t_read = 0.
self.t_mask = 0.
......@@ -276,7 +276,7 @@ class PeakFitter(Thread):
self.t_fit += t_fit_
self.t_write += t_write_
res_times = myTimes()
res_times = MyTimes()
callback = res_times.update
else:
callback = None
......@@ -411,18 +411,17 @@ def _fit_process(th_idx, roiIndices=None):
while True:
# TODO : timeout
next = idx_queue.get()
data = idx_queue.get()
if next is None:
if data is None:
break
i_fit, i_cube = next
i_fit, i_cube = data
progress[th_idx] = i_fit
if i_cube % 100 == 0:
print(
'Processing cube {0}/{1}.'.format(i_fit, result_shape[0]))
print('Processing cube {0}/{1}.'.format(i_fit, result_shape[0]))
t0 = time.time()
with qspace_h5.qspace_dset_ctx() as dset:
......
Markdown is supported
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