Skip to content

Commit

Permalink
Merge pull request #670 from Verdant-Evolution/remove-unnecessary-pas…
Browse files Browse the repository at this point in the history
…s-statements

Remove unnecessary pass statements
  • Loading branch information
kevindlewis23 authored Jul 11, 2024
2 parents 53e0b1b + a0db9da commit 5ecf297
Show file tree
Hide file tree
Showing 36 changed files with 24 additions and 164 deletions.
1 change: 0 additions & 1 deletion hexrd/cli/fit_grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ def execute(args, parser):
gid_list = None
if args.grains is not None:
gid_list = [int(i) for i in args.grains.split(',')]
pass

fit_results = fit_grains(
cfg,
Expand Down
4 changes: 2 additions & 2 deletions hexrd/distortion/distortionabc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class DistortionABC(metaclass=abc.ABCMeta):
@abc.abstractmethod
def apply(self, xy_in):
"""Apply distortion mapping"""
pass
raise NotImplementedError

@abc.abstractmethod
def apply_inverse(self, xy_in):
"""Apply inverse distortion mapping"""
pass
raise NotImplementedError
2 changes: 0 additions & 2 deletions hexrd/distortion/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ def register(cls, acls):
"""Register adapter class"""
if acls.__name__ != 'DistortionBase':
cls.distortion_registry[acls.maptype] = acls

pass # end class
4 changes: 0 additions & 4 deletions hexrd/findorientations.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def generate_orientation_fibers(cfg, eta_ome):
ome_c = eta_ome.omeEdges[0] + (0.5 + coms[i][ispot][0])*del_ome
eta_c = eta_ome.etaEdges[0] + (0.5 + coms[i][ispot][1])*del_eta
input_p.append(np.hstack([this_hkl, this_tth, eta_c, ome_c]))
pass
pass
pass

# do the mapping
start = timeit.default_timer()
Expand All @@ -155,7 +152,6 @@ def generate_orientation_fibers(cfg, eta_ome):
discretefiber_reduced, input_p, chunksize=chunksize
), total=ntotal
):
pass
print(_.shape)
'''
pool.close()
Expand Down
8 changes: 1 addition & 7 deletions hexrd/fitgrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ def fit_grain_FF_reduced(grain_id):
culled_results[det_key] = [presults[i] for i in np.where(idx)[0]]
num_refl_tot += len(valid_refl_ids)
num_refl_valid += sum(valid_refl_ids)

pass # now we have culled data
# now we have culled data

# CAVEAT: completeness from pullspots only; incl saturated and overlaps
# <JVB 2015-12-15>
Expand Down Expand Up @@ -220,8 +219,6 @@ def fit_grain_FF_reduced(grain_id):
plane_data.latVecOps['B'], plane_data.wavelength,
ome_period,
simOnly=False, return_value_flag=2)
pass # end conditional on fit
pass # end tolerance looping

if refit is not None:
# first get calculated x, y, ome from previous solution
Expand Down Expand Up @@ -279,7 +276,6 @@ def fit_grain_FF_reduced(grain_id):
]

num_refl_valid += sum(idx_new)
pass

# only execute fit if left with enough reflections
if num_refl_valid > 12:
Expand All @@ -297,8 +293,6 @@ def fit_grain_FF_reduced(grain_id):
plane_data.latVecOps['B'], plane_data.wavelength,
ome_period,
simOnly=False, return_value_flag=2)
pass
pass # close refit conditional
return grain_id, completeness, chisq, grain_params


Expand Down
12 changes: 6 additions & 6 deletions hexrd/fitting/calibration/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Calibrator(ABC):
@abstractmethod
def type(self):
"""The type of the calibrator"""
pass
raise NotImplementedError

@abstractmethod
def create_lmfit_params(self, current_params):
Expand All @@ -25,7 +25,7 @@ def create_lmfit_params(self, current_params):
for the lattice parameters. The Laue calibrator creates lmfit
parameters for crystal parameters.
"""
pass
raise NotImplementedError

@abstractmethod
def update_from_lmfit_params(self, params_dict):
Expand All @@ -38,7 +38,7 @@ def update_from_lmfit_params(self, params_dict):
For example, the powder calibrator will update the lattice parameters
on the material. The Laue calibrator will update crystal parameters.
"""
pass
raise NotImplementedError

@abstractmethod
def residual(self, calibration_data=None):
Expand All @@ -48,7 +48,7 @@ def residual(self, calibration_data=None):
the calibration class instead, in which case, calibration_data can
be `None`.
"""
pass
raise NotImplementedError

@property
@abstractmethod
Expand All @@ -73,10 +73,10 @@ def calibration_picks(self):
string of the hkl. And "picks" are either a list of points (powder)
or a single point (laue). The picks are in cartesian coordinates.
"""
pass
raise NotImplementedError

@calibration_picks.setter
@abstractmethod
def calibration_picks(self, val):
"""Setter for calibration_picks. See getter docs for details."""
pass
raise NotImplementedError
5 changes: 0 additions & 5 deletions hexrd/fitting/calibration/laue.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def autopick_points(self, raw_img_dict, tth_tol=5., eta_tol=5.,
valid_hkls = hkls[gid][:, valid_refl]
valid_angs = angles[gid][valid_refl, :]
valid_energy = energy[gid][valid_refl]
# pass

# make patches
refl_patches = xrdutil.make_reflection_patches(
Expand Down Expand Up @@ -291,7 +290,6 @@ def autopick_points(self, raw_img_dict, tth_tol=5., eta_tol=5.,
#
else:
closest_peak_idx = 0
pass # end multipeak conditional
#
coms = coms[closest_peak_idx]
#
Expand Down Expand Up @@ -338,7 +336,6 @@ def autopick_points(self, raw_img_dict, tth_tol=5., eta_tol=5.,
gaussian_2d_int,
[[0., 2.*y0], [0., 2.*x0]],
args=fit_par)
pass
com_angs = np.hstack([
tth_edges[0] + (0.5 + coms[1])*delta_tth,
eta_edges[0] + (0.5 + coms[0])*delta_eta
Expand Down Expand Up @@ -382,14 +379,12 @@ def autopick_points(self, raw_img_dict, tth_tol=5., eta_tol=5.,
#
spot_intensity = np.nan
max_intensity = np.nan
pass
reflInfoList.append([peakId, valid_hkls[:, iRefl],
(spot_intensity, max_intensity),
valid_energy[iRefl],
valid_angs[iRefl, :],
meas_angs[iRefl, :],
meas_xy[iRefl, :]])
pass
reflInfo = np.array(
[tuple(i) for i in reflInfoList],
dtype=reflInfo_dtype)
Expand Down
4 changes: 0 additions & 4 deletions hexrd/fitting/calibration/multigrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ def sxcal_obj_func(plist_fit, plist_full,
xy_unwarped[det_key][ig] = panel.distortion.apply(
xy_unwarped[det_key][ig]
)
pass

# transform G-vectors:
# 1) convert inv. stretch tensor from MV notation in to 3x3
Expand Down Expand Up @@ -286,8 +285,6 @@ def sxcal_obj_func(plist_fit, plist_full,

calc_omes[det_key].append(calc_omes_tmp)
calc_xy[det_key].append(calc_xy_tmp)
pass
pass

# return values
if sim_only:
Expand All @@ -311,7 +308,6 @@ def sxcal_obj_func(plist_fit, plist_full,
calc_xy_all.append(np.vstack(calc_xy[det_key]))
meas_omes_all.append(np.hstack(meas_omes[det_key]))
calc_omes_all.append(np.hstack(calc_omes[det_key]))
pass
meas_xy_all = np.vstack(meas_xy_all)
calc_xy_all = np.vstack(calc_xy_all)
meas_omes_all = np.hstack(meas_omes_all)
Expand Down
2 changes: 0 additions & 2 deletions hexrd/fitting/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ def objFuncFitGrain(gFit, gFull, gFlag,
meas_omes = meas_xyo[:, 2]
xy_unwarped = panel.distortion.apply(meas_xyo[:, :2])
meas_xyo = np.vstack([xy_unwarped.T, meas_omes]).T
pass

# append to meas_omes
meas_xyo_all.append(meas_xyo)
Expand Down Expand Up @@ -251,7 +250,6 @@ def objFuncFitGrain(gFit, gFull, gFlag,

# append to xy dict
calc_xy_dict[det_key] = calc_xy
pass

# stack results to concatenated arrays
calc_omes_all = np.hstack([calc_omes_dict[k] for k in det_keys_ordered])
Expand Down
2 changes: 0 additions & 2 deletions hexrd/grainmap/nfutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
logging.info(f'{rank=} {world_size=} {hostname=}')
except ImportError:
logging.warning(f'mpi4py failed to load on {hostname=}. MPI is disabled.')
pass


# Import of image loading, this should probably be done properly with preprocessed frame-cache binaries
Expand Down Expand Up @@ -809,7 +808,6 @@ def evaluate_diffraction_angles(experiment, controller=None):
distortion=None)
all_angles.append(sim_results[2])
controller.update(i + 1)
pass
controller.finish(subprocess)

return all_angles
Expand Down
2 changes: 0 additions & 2 deletions hexrd/imageseries/baseclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ def shape(self):
@property
def metadata(self):
return self._adapter.metadata

pass # end class
2 changes: 0 additions & 2 deletions hexrd/imageseries/load/framecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,3 @@ def __iter__(self):
#@memoize
def __len__(self):
return self._nframes

pass # end class
3 changes: 0 additions & 3 deletions hexrd/imageseries/load/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def __del__(self):
self.close()
except(Exception):
warnings.warn("HDF5ImageSeries could not close h5 file")
pass

def __getitem__(self, key):
if self._ndim == 2:
Expand Down Expand Up @@ -138,5 +137,3 @@ def shape(self):
return self.__image_dataset.shape
else:
return self.__image_dataset.shape[1:]

pass # end class
2 changes: 0 additions & 2 deletions hexrd/imageseries/load/imagefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ def _load_data(self, filename, frame=None):

return _process_data(filename, data)

pass # end class


class FileInfo(object):
"""class for managing individual file information"""
Expand Down
2 changes: 0 additions & 2 deletions hexrd/imageseries/load/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ def register(cls, acls):
"""Register adapter class"""
if acls.__name__ != 'ImageSeriesAdapter':
cls.adapter_registry[acls.format] = acls

pass # end class
2 changes: 0 additions & 2 deletions hexrd/imageseries/omega.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ def save_omegas(self, fname):
"""
np.save(fname, self.omegas)

pass # end class


class OmegaSeriesError(Exception):
def __init__(self, value):
Expand Down
2 changes: 0 additions & 2 deletions hexrd/imageseries/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,3 @@ def addop(self, key, func):
def oplist(self):
"""list of operations to apply"""
return self._oplist

pass # end class
4 changes: 0 additions & 4 deletions hexrd/imageseries/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def register(cls, wcls):
def getwriter(cls, name):
"""return instance associated with name"""
return cls.writer_registry[name]
#
pass # end class


class Writer(object, metaclass=_RegisterWriter):
Expand Down Expand Up @@ -193,8 +191,6 @@ def h5opts(self):

return d

pass # end class


class WriteFrameCache(Writer):
"""write frame cache imageseries
Expand Down
Loading

0 comments on commit 5ecf297

Please sign in to comment.