From e28e18372555bc56474ba0fbb716ec028a25e08c Mon Sep 17 00:00:00 2001 From: Kurt Schwehr Date: Fri, 22 Mar 2024 11:33:05 -0700 Subject: [PATCH] codespell (#165) --- VERSIONS.txt | 16 ++++++++-------- spectral/algorithms/algorithms.py | 22 +++++++++++----------- spectral/algorithms/classifiers.py | 2 +- spectral/algorithms/clustering.py | 4 ++-- spectral/algorithms/continuum.py | 16 ++++++++-------- spectral/algorithms/detectors.py | 12 ++++++------ spectral/algorithms/perceptron.py | 2 +- spectral/algorithms/spatial.py | 8 ++++---- spectral/algorithms/spymath.py | 2 +- spectral/algorithms/transforms.py | 4 ++-- spectral/database/aster.py | 6 +++--- spectral/database/ecostress.py | 4 ++-- spectral/database/usgs.py | 8 ++++---- spectral/graphics/graphics.py | 14 +++++++------- spectral/graphics/ndwindow.py | 20 ++++++++++---------- spectral/graphics/spypylab.py | 2 +- spectral/graphics/spywxpythonthread.py | 2 +- spectral/image.py | 6 +++--- spectral/io/bilfile.py | 2 +- spectral/io/bipfile.py | 2 +- spectral/io/bsqfile.py | 2 +- spectral/io/envi.py | 10 +++++----- spectral/io/spyfile.py | 6 +++--- spectral/tests/envi.py | 6 +++--- 24 files changed, 89 insertions(+), 89 deletions(-) diff --git a/VERSIONS.txt b/VERSIONS.txt index 4c95ca3..7ef9784 100644 --- a/VERSIONS.txt +++ b/VERSIONS.txt @@ -126,7 +126,7 @@ Release date: 2019.10.06 New Features ------------ -* Support for ECOSTRESS spectral library (supercedes ASTER library). +* Support for ECOSTRESS spectral library (supersedes ASTER library). * Accept "mask" and "bg" keywords in `imshow` and `get_rgb` (affects color scaling). @@ -189,7 +189,7 @@ Bug Fixes * Fixed a bug that potentially produced incorrect results in `map_class_ids` (issue #53). -* Removed unecessary import that cause python3 compatibility error in +* Removed unnecessary import that cause python3 compatibility error in `aviris.open` (issue #54). * Removed `has_key` call breaking python3 compatibility (issue #56). @@ -439,7 +439,7 @@ Performance Improvements ------------------------ * PerceptronClassifier is roughly an order of magnitude faster due to better - use of numpy. Inputs are now scaled and weights are initialized withing the + use of numpy. Inputs are now scaled and weights are initialized within the data limits, which usually results in fewer iterations for convergence. ================================================================================ @@ -490,7 +490,7 @@ New Features Performance Improvements ------------------------ -* Significant speedup for sevaral algorithms using ndarray inputs: +* Significant speedup for several algorithms using ndarray inputs: * 14x speedup for GMCL @@ -528,7 +528,7 @@ Changes Bug Fixes --------- -* Exception occured when *bands* argument was not provided to `imshow`. +* Exception occurred when *bands* argument was not provided to `imshow`. * *stretch_all* parameter for `get_rgb` was sometimes being used when set to False or 0 (because it was not None). @@ -572,7 +572,7 @@ Changes * If present, image band info is saved when `envi.save_image` is called. * Allow calling :func:`~spectral.oi.envi.create_image` using keyword args - instead of ENVI-specific header paramter names. + instead of ENVI-specific header parameter names. * `save_rgb` automatically determines the output file type, based on the filename extension. @@ -748,7 +748,7 @@ Release date: 2012.07.15 - Bug Fixes - - Fixed a bug in several deprecation warnings that caused infinte recursion. + - Fixed a bug in several deprecation warnings that caused infinite recursion. - Fixed mismatch in parameter names in kmeans_ndarray. @@ -796,7 +796,7 @@ Release date: 2011.01.17 - :meth:`spectral.kmeans` will accept a :exc:`KeyboardInterrupt` exception (i.e., CTRL-C) and return the results as of the previous iteration. - - Documention is now online via Sphinx. + - Documentation is now online via Sphinx. - Changes diff --git a/spectral/algorithms/algorithms.py b/spectral/algorithms/algorithms.py index 1f2852d..ab14505 100644 --- a/spectral/algorithms/algorithms.py +++ b/spectral/algorithms/algorithms.py @@ -147,7 +147,7 @@ def iterator_ij(mask, index=None): If `index` is not defined, iteration is performed over all non-zero elements. If `index` is defined, iteration is performed over all - coordinates for whch `mask[i,j] == index`. + coordinates for which `mask[i,j] == index`. ''' if mask.ndim != 2: @@ -271,7 +271,7 @@ def cov_avg(image, mask, weighted=True): `mask` (integer-valued ndarray): Elements specify the classes associated with pixels in `image`. - All pixels associeted with non-zero elements of `mask` will be + All pixels associated with non-zero elements of `mask` will be used in the covariance calculation. `weighted` (bool, default True): @@ -1174,7 +1174,7 @@ def ndvi(data, red, nir): def bdist(class1, class2): ''' - Calulates the Bhattacharyya distance between two classes. + Calculates the Bhattacharyya distance between two classes. USAGE: bd = bdist(class1, class2) @@ -1201,7 +1201,7 @@ def bdist(class1, class2): def bdist_terms(a, b): ''' - Calulate the linear and quadratic terms of the Bhattacharyya distance + Calculate the linear and quadratic terms of the Bhattacharyya distance between two classes. USAGE: (linTerm, quadTerm) = bDistanceTerms(a, b) @@ -1438,7 +1438,7 @@ def noise_from_diffs(X, direction='lowerright'): `X` (np.ndarray): - The data from which to estimage noise statistics. `X` should have + The data from which to estimate noise statistics. `X` should have shape `(nrows, ncols, nbands`). `direction` (str, default "lowerright"): @@ -1495,7 +1495,7 @@ def __init__(self, signal, noise, napc): `napc` (:class:`~spectral.PrincipalComponents`): - Noise-Adjusted Pricipal Components + Noise-Adjusted Principal Components ''' self.signal = signal self.noise = noise @@ -1592,7 +1592,7 @@ def reduce(self, X, **kwargs): Threshold signal-to-noise ratio (SNR) to retain. - Returns a verions of `X` with reduced dimensionality. + Returns a versions of `X` with reduced dimensionality. Note that calling this method is equivalent to calling the `get_reduction_transform` method with same keyword and applying the @@ -1725,13 +1725,13 @@ def ppi(X, niters, threshold=0, centered=False, start=None, display=0, An optional array of initial purity indices. This can be used to continue computing PPI values after a previous call to `ppi` (i.e., - set `start` equal to the return value from a previou call to `ppi`. + set `start` equal to the return value from a previous call to `ppi`. This should be an integer-valued array whose dimensions are equal to the first two dimensions of `X`. `display` (integer): - If set to a postive integer, a :class:`~spectral.graphics.spypylab.ImageView` + If set to a positive integer, a :class:`~spectral.graphics.spypylab.ImageView` window will be opened and dynamically display PPI values as the function iterates. The value specifies the number of PPI iterations between display updates. It is recommended to use a value around @@ -1751,7 +1751,7 @@ def ppi(X, niters, threshold=0, centered=False, start=None, display=0, These keywords will be passed to the image display and only have an effect if the `display` argument is nonzero. - This function can be interruped with a KeyboardInterrupt (ctrl-C), in which + This function can be interrupted with a KeyboardInterrupt (ctrl-C), in which case, the most recent value of the PPI array will be returned. This can be used in conjunction with the `display` argument to view the progression of the PPI values until they appear stable, then terminate iteration using @@ -1920,7 +1920,7 @@ def smacc(spectra, min_endmembers=None, max_residual_norm=float('Inf')): for k in range(len(Fs)): t = On * Fs[k][q[n]] # This is not so important for the algorithm itself. - # These values correpond to values where On == 0.0, and these + # These values correspond to values where On == 0.0, and these # will be zeroed out below. But to avoid divide-by-zero warning # we set small values instead of zero. t[t == 0.0] = 1e-10 diff --git a/spectral/algorithms/classifiers.py b/spectral/algorithms/classifiers.py index f0aa781..3a17b40 100644 --- a/spectral/algorithms/classifiers.py +++ b/spectral/algorithms/classifiers.py @@ -284,7 +284,7 @@ class PerceptronClassifier(Perceptron, SupervisedClassifier): '''A multi-layer perceptron classifier with backpropagation learning. Multi-layer perceptrons often require many (i.e., thousands) of iterations - through the traning data to converge on a solution. Therefore, it is not + through the training data to converge on a solution. Therefore, it is not recommended to attempt training a network on full-dimensional hyperspectral data or even on a full set of image pixels. It is likely preferable to first train the network on a subset of the data, then retrain the network diff --git a/spectral/algorithms/clustering.py b/spectral/algorithms/clustering.py index 0e574d1..acdf41b 100644 --- a/spectral/algorithms/clustering.py +++ b/spectral/algorithms/clustering.py @@ -72,7 +72,7 @@ def kmeans(image, nclusters=10, max_iterations=20, **kwargs): `class_map` (:class:`numpy.ndarray`): - An `MxN` array whos values are the indices of the cluster for the + An `MxN` array who's values are the indices of the cluster for the corresponding element of `image`. `centers` (:class:`numpy.ndarray`): @@ -250,7 +250,7 @@ def kmeans_ndarray(image, nclusters=10, max_iterations=20, **kwargs): `class_map` (:class:`numpy.ndarray`): - An `MxN` array whos values are the indices of the cluster for the + An `MxN` array who's values are the indices of the cluster for the corresponding element of `image`. `centers` (:class:`numpy.ndarray`): diff --git a/spectral/algorithms/continuum.py b/spectral/algorithms/continuum.py index 8e9808b..5090496 100644 --- a/spectral/algorithms/continuum.py +++ b/spectral/algorithms/continuum.py @@ -4,7 +4,7 @@ Continuum is defined as convex hull of spectrum. Continuum is removed from spectra by dividing spectra by its continuum. That results in values between 0 and 1, where absorption bands are expressed as -drops below 1. It is usefull for comparing and classification based on +drops below 1. It is useful for comparing and classification based on absorption bands and indifferent to scale. References: @@ -239,13 +239,13 @@ def continuum_points(spectrum, bands, mode='convex'): 1d :class:`numpy.ndarray`, holding band values of spectra. Length of `bands` should be the same as `spectrum`. Note that bands should be sorted in ascending order (which is often - not the case with AVIRIS), otherwise unexpected results could occure. + not the case with AVIRIS), otherwise unexpected results could occur. `mode` (string, default 'convex'): Default mode is 'convex' which returns convex upper hull of the spectrum. Another supported mode is 'segmented' which builds - segmented upper hull. This is usefull to identify more detailed + segmented upper hull. This is useful to identify more detailed contour of the spectrum, but without strong absorption bands. Returns: @@ -286,13 +286,13 @@ def spectral_continuum(spectra, bands, mode='convex', out=None): 1d :class:`numpy.ndarray`, holding band values of spectra. Length of `bands` should be the same as last dimension of `spectra`. Note that bands should be sorted in ascending order (which is often - not the case with AVIRIS), otherwise unexpected results could occure. + not the case with AVIRIS), otherwise unexpected results could occur. `mode` (string, default 'convex'): Default mode is 'convex' which returns convex upper hull of the spectrum. Another supported mode is 'segmented' which builds - segmented upper hull. This is usefull to identify more detailed + segmented upper hull. This is useful to identify more detailed contour of the spectrum, but without strong absorption bands. `out` (:class:`numpy.ndarray`, default None): @@ -313,7 +313,7 @@ def spectral_continuum(spectra, bands, mode='convex', out=None): def remove_continuum(spectra, bands, mode='convex', out=None): '''Returns spectra with continuum removed. Continuum is defined as convex hull of spectra. Continuum is removed from - spectra by deviding spectra by its continuum. + spectra by dividing spectra by its continuum. Arguments: @@ -327,13 +327,13 @@ def remove_continuum(spectra, bands, mode='convex', out=None): 1d :class:`numpy.ndarray`, holding band values of spectra. Length of `bands` should be the same as last dimension of `spectra`. Note that bands should be sorted in ascending order (which is often - not the case with AVIRIS), otherwise unexpected results could occure. + not the case with AVIRIS), otherwise unexpected results could occur. `mode` (string, default 'convex'): Default mode is 'convex' which removes convex upper hull of the spectrum. Another supported mode is 'segmented' which removes - segmented upper hull. This is usefull to identify two or more small + segmented upper hull. This is useful to identify two or more small features instead of one large feature. `out` (:class:`numpy.ndarray`, default None): diff --git a/spectral/algorithms/detectors.py b/spectral/algorithms/detectors.py index d6e1427..3ac67dc 100644 --- a/spectral/algorithms/detectors.py +++ b/spectral/algorithms/detectors.py @@ -124,7 +124,7 @@ def matched_filter(X, target, background=None, window=None, cov=None): Must have the form (`inner`, `outer`), where the two values specify the widths (in pixels) of inner and outer windows centered - about the pixel being evaulated. Both values must be odd integers. + about the pixel being evaluated. Both values must be odd integers. The background mean and covariance will be estimated from pixels in the outer window, excluding pixels within the inner window. For example, if (`inner`, `outer`) = (5, 21), then the number of @@ -319,7 +319,7 @@ def rx(X, background=None, window=None, cov=None): Must have the form (`inner`, `outer`), where the two values specify the widths (in pixels) of inner and outer windows centered - about the pixel being evaulated. Both values must be odd integers. + about the pixel being evaluated. Both values must be odd integers. The background mean and covariance will be estimated from pixels in the outer window, excluding pixels within the inner window. For example, if (`inner`, `outer`) = (5, 21), then the number of @@ -407,7 +407,7 @@ def __init__(self, target, background=None, **kwargs): `vectorize` (bool, default True): Specifies whether the __call__ method should attempt to vectorize - operations. This typicall results in faster computation but will + operations. This typically results in faster computation but will consume more memory. ''' for k in kwargs: @@ -564,7 +564,7 @@ def ace(X, target, background=None, window=None, cov=None, **kwargs): The return value will be an ndarray with shape (R, C). A length-D sequence (e.g., list or tuple) of length-B ndarrays. - In this case, the detector will be applied seperately to each of + In this case, the detector will be applied separately to each of the `D` targets. This is equivalent to calling the function sequentially for each target and stacking the results but is much faster. The return value will be an ndarray with shape @@ -580,7 +580,7 @@ def ace(X, target, background=None, window=None, cov=None, **kwargs): Must have the form (`inner`, `outer`), where the two values specify the widths (in pixels) of inner and outer windows centered - about the pixel being evaulated. Both values must be odd integers. + about the pixel being evaluated. Both values must be odd integers. The background mean and covariance will be estimated from pixels in the outer window, excluding pixels within the inner window. For example, if (`inner`, `outer`) = (5, 21), then the number of @@ -615,7 +615,7 @@ def ace(X, target, background=None, window=None, cov=None, **kwargs): `vectorize` (bool, default True): Specifies whether the function should attempt to vectorize - operations. This typicall results in faster computation but will + operations. This typically results in faster computation but will consume more memory. Returns numpy.ndarray: diff --git a/spectral/algorithms/perceptron.py b/spectral/algorithms/perceptron.py index 9b2c8a6..8ac91cc 100644 --- a/spectral/algorithms/perceptron.py +++ b/spectral/algorithms/perceptron.py @@ -47,7 +47,7 @@ def __init__(self, shape, k=1.0, weights=None): def randomize_weights(self): '''Randomizes the layer weight matrix. The bias weight will be in the range [0, 1). The remaining weights will - correspond to a vector with unit length and uniform random orienation. + correspond to a vector with unit length and uniform random orientation. ''' self.weights = 1. - 2. * np.random.rand(*self.shape) for row in self.weights: diff --git a/spectral/algorithms/spatial.py b/spectral/algorithms/spatial.py index cba35f4..c144f93 100644 --- a/spectral/algorithms/spatial.py +++ b/spectral/algorithms/spatial.py @@ -192,7 +192,7 @@ def map_window(func, image, window, rslice=(None,), cslice=(None,), `border` (string, default "shift"): Indicates how to handles windows near the edge of the window. If - the value is "shift", the window dimensions will alway be + the value is "shift", the window dimensions will always be `(width, height)` but near the image border the pixel being iterated will be offset from the center of the window. If set to "clip", window regions falling outside the image border will be @@ -331,7 +331,7 @@ def map_outer_window_stats(func, image, inner, outer, dim_out=1, cov=None, class WindowedGaussianBackgroundMapper(object): - '''A class for procucing window statistics with an inner exclusion window. + '''A class for producing window statistics with an inner exclusion window. ''' def __init__(self, inner, outer, function=None, cov=None, dim_out=None, dtype=None): @@ -341,11 +341,11 @@ def __init__(self, inner, outer, function=None, cov=None, dim_out=None, `inner` (integer or 2-tuple of integers): - Width and heigth of inner window, in pixels. + Width and height of inner window, in pixels. `outer` (integer or 2-tuple of integers): - Width and heigth of outer window, in pixels. Dimensions must + Width and height of outer window, in pixels. Dimensions must be greater than inner window `function` (callable object): diff --git a/spectral/algorithms/spymath.py b/spectral/algorithms/spymath.py index d007fb0..cfe9dcd 100644 --- a/spectral/algorithms/spymath.py +++ b/spectral/algorithms/spymath.py @@ -67,7 +67,7 @@ def get_histogram_cdf_points(data, cdf_vals, ignore=None, mask=None): `ignore` (numeric, default `None`): A scalar value that should be ignored when computing histogram - points (e.g., a value that indicates bad data). If this valus is + points (e.g., a value that indicates bad data). If this value is not specified, all data are used. Return value: diff --git a/spectral/algorithms/transforms.py b/spectral/algorithms/transforms.py index fb068a6..62fac21 100644 --- a/spectral/algorithms/transforms.py +++ b/spectral/algorithms/transforms.py @@ -39,7 +39,7 @@ def __init__(self, A, **kwargs): An (J,K) array to be applied to length-K targets. - Keyword Argments: + Keyword Arguments: `pre` (scalar or length-K sequence): @@ -58,7 +58,7 @@ def __init__(self, A, **kwargs): self._post = kwargs.get('post', None) A = np.array(A, copy=True) if A.ndim == 0: - # Do not know input/ouput dimensions + # Do not know input/output dimensions self._A = A (self.dim_out, self.dim_in) = (None, None) else: diff --git a/spectral/database/aster.py b/spectral/database/aster.py index 2157530..262ceb7 100644 --- a/spectral/database/aster.py +++ b/spectral/database/aster.py @@ -59,7 +59,7 @@ def read_aster_file(filename): # Number of lines per metadata attribute value lpv = [1] * 8 + [2] + [6] - # A few files have an additional "Colleted by" sample metadata field, which + # A few files have an additional "Collected by" sample metadata field, which # sometimes affects the number of header lines haveCollectedBy = False @@ -283,7 +283,7 @@ class Sig: environment = 'lab' m = sig.measurement - # Correct numerous mispellings of "reflectance" and "transmittance" + # Correct numerous misspellings of "reflectance" and "transmittance" yUnit = m['y units'] if yUnit.find('reflectence') > -1: yUnit = 'reflectance (percent)' @@ -331,7 +331,7 @@ def get_spectrum(self, spectrumID): Spectrum data values for each band. Returns a pair of vectors containing the wavelengths and measured - values values of a measurment. For additional metadata, call + values values of a measurement. For additional metadata, call "get_signature" instead. ''' import array diff --git a/spectral/database/ecostress.py b/spectral/database/ecostress.py index bb041b1..4d00950 100644 --- a/spectral/database/ecostress.py +++ b/spectral/database/ecostress.py @@ -44,7 +44,7 @@ def metaline_to_pair(line): return [x.strip() for x in line.split(':', 1)] logger.error('Failed to parse line: {}: {}'.format(i, lines[i])) raise - # Read measurment metadata + # Read measurement metadata for j in itertools.count(i): if len(lines[j].strip()) == 0: break @@ -196,7 +196,7 @@ class Sig: environment = 'lab' m = sig.measurement - # Correct numerous mispellings of "reflectance" and "transmittance" + # Correct numerous misspellings of "reflectance" and "transmittance" yUnit = m['y units'] if yUnit.find('reflectence') > -1: yUnit = 'reflectance (percent)' diff --git a/spectral/database/usgs.py b/spectral/database/usgs.py index 1249912..6d252dc 100644 --- a/spectral/database/usgs.py +++ b/spectral/database/usgs.py @@ -300,7 +300,7 @@ class USGSDatabase(SpectralDatabase): def _assume_wavelength_spectrometer_data_id(self, sampleData): # We can't know this for sure, but these heuristics haven't failed so far. - # Prepare paramters. + # Prepare parameters. # These parameters are mandatory to match. libname = sampleData.libname num_values = len(sampleData.values) @@ -393,7 +393,7 @@ def create(cls, filename, usgs_data_dir=None): `usgs_data_dir` (str): Path to the USGS ASCII data directory. This directory should - contain subdirectories, which containes chapter directories. + contain subdirectories, which contains chapter directories. E.g. if provided `usgs_data_dir` is '/home/user/usgs/ASCIIdata', then relative path to single sample could be 'ASCIIdata_splib07b/ChapterL_Liquids/splib07b_H2O-Ice_GDS136_77K_BECKa_AREF.txt' @@ -524,14 +524,14 @@ def get_spectrum(self, sampleID): `x` (list): Band centers for the spectrum. - This is extraced from assumed spectrometer for given sample. + This is extratced from assumed spectrometer for given sample. `y` (list): Spectrum data values for each band. Returns a pair of vectors containing the wavelengths and measured - values values of a measurment. + values values of a measurement. ''' query = '''SELECT ValuesArray, AssumedWLSpmeterDataID FROM Samples WHERE SampleID = ?''' result = self.cursor.execute(query, (sampleID,)) diff --git a/spectral/graphics/graphics.py b/spectral/graphics/graphics.py index 8da4c6c..8d26b7f 100644 --- a/spectral/graphics/graphics.py +++ b/spectral/graphics/graphics.py @@ -120,7 +120,7 @@ def view_cube(data, *args, **kwargs): `top` (:class:`numpy.ndarray` or :class:`PIL.Image`): - Data to display on top of the cube. This will supercede the + Data to display on top of the cube. This will supersede the `bands` keyword. `scale` (:class:`spectral.ColorScale`) @@ -196,11 +196,11 @@ def view_nd(data, *args, **kwargs): associated with the 3 semi-axes for that octant. #. A length-8 list of length-3 lists of integers. In this case, - each length-3 list specfies the features to be displayed in a + each length-3 list specifies the features to be displayed in a single octants (the same semi-axis can be associated with different features in different octants). Octants are ordered - starting with the postive x,y,z octant and procede - counterclockwise around the z-axis, then procede similarly + starting with the positive x,y,z octant and proceed + counterclockwise around the z-axis, then proceed similarly around the negative half of the z-axis. An octant triplet can be specified as None instead of a list, in which case nothing will be rendered in that octant. @@ -379,7 +379,7 @@ def save_rgb(filename, data, bands=None, **kwargs): Source image data to display. `data` can be and instance of a :class:`spectral.Image` (e.g., :class:`spectral.SpyFile` or :class:`spectral.ImageArray`) or a :class:`numpy.ndarray`. `data` - must have shape `MxN` or `MxNxB`. If thes shape is `MxN`, the + must have shape `MxN` or `MxNxB`. If the shape is `MxN`, the image will be saved as greyscale (unless keyword `colors` is specified). If the shape is `MxNx3`, it will be interpreted as three `MxN` images defining the R, G, and B channels respectively. @@ -645,7 +645,7 @@ def get_rgb_meta(source, bands=None, **kwargs): # Determine data limits for color stretch from given cumulative # histogram values. if stretch in (True, False): - msg = 'Boolean values for `stretch` keyword are deprected. See ' \ + msg = 'Boolean values for `stretch` keyword are deprecated. See ' \ 'docstring for `get_rgb`' warnings.warn(msg) stretch = settings.imshow_stretch @@ -723,7 +723,7 @@ def warn_no_ipython(): '''Warns that user is calling a GUI function outside of ipython.''' msg = ''' ############################################################################# -SPy graphics functions are inteded to be run from IPython with the +SPy graphics functions are intended to be run from IPython with the `pylab` mode set for wxWindows. For example, # ipython --pylab=WX diff --git a/spectral/graphics/ndwindow.py b/spectral/graphics/ndwindow.py index c6b1123..7243543 100644 --- a/spectral/graphics/ndwindow.py +++ b/spectral/graphics/ndwindow.py @@ -182,10 +182,10 @@ def reassign_points(self, event): def create_mirrored_octants(feature_indices): '''Takes a list of 6 integers and returns 8 lists of feature index - triplets. The 6 indices passed each specify a feature to be associatd with + triplets. The 6 indices passed each specify a feature to be associated with a semi-axis in the 3D display. Each of the 8 returned triplets specifies the 3 features associated with particular octant, starting with the - positive x,y,z octant, proceding counterclockwise around the z-axis then + positive x,y,z octant, proceeding counterclockwise around the z-axis then similarly for the negative half of the z-axis. ''' f = feature_indices @@ -258,11 +258,11 @@ def set_features(self, *args, **kwargs): #. If `mode` is set to "independent", then `features` must be a length-8 list of length-3 lists of integers. In this case, each - length-3 list specfies the features to be displayed in a single + length-3 list specifies the features to be displayed in a single octants (the same semi-axis can be associated with different features in different octants). Octants are ordered starting - with the postive x,y,z octant and procede counterclockwise - around the z-axis, then procede similarly around the negative + with the positive x,y,z octant and proceed counterclockwise + around the z-axis, then proceed similarly around the negative half of the z-axis. An octant triplet can be specified as None instead of a list, in which case nothing will be rendered in that octant. @@ -386,7 +386,7 @@ def set_data(self, data, **kwargs): classes (numpy.ndarray): An RxC array of integer class labels (zeros means unassigned). features (list): - Indices of feautures to display in the octant (see + Indices of features to display in the octant (see NDWindow.set_octant_display_features for description). ''' import OpenGL.GL as gl @@ -455,11 +455,11 @@ def set_octant_display_features(self, features): (in that order). Each octant will display data points using the features associated with the 3 semi-axes for that octant. A length-8 list of length-3 lists of integers: - In this case, each length-3 list specfies the features to be + In this case, each length-3 list specifies the features to be displayed in a single octants (the same semi-axis can be associated with different features in different octants). Octants are ordered - starting with the postive x,y,z octant and procede counterclockwise - around the z-axis, then procede similarly around the negative half + starting with the positive x,y,z octant and proceed counterclockwise + around the z-axis, then proceed similarly around the negative half of the z-axis. An octant triplet can be specified as None instead of a list, in which case nothing will be rendered in that octant. ''' @@ -674,7 +674,7 @@ def reassign_selection(self, new_class): color, then reassigning them. Since pixels can block others in the z-buffer, this method iteratively reassigns pixels by removing any reassigned pixels from the display list, then reassigning again, - repeating until there are no more pixels in the selction box. + repeating until there are no more pixels in the selection box. ''' nreassigned_tot = 0 i = 1 diff --git a/spectral/graphics/spypylab.py b/spectral/graphics/spypylab.py index a1a6266..7660714 100644 --- a/spectral/graphics/spypylab.py +++ b/spectral/graphics/spypylab.py @@ -651,7 +651,7 @@ def set_classes(self, classes, colors=None, **kwargs): `colors`: (array or 3-tuples): Color triplets (with values in the range [0, 255]) that - define the colors to be associatd with the integer indices + define the colors to be associated with the integer indices in `classes`. Keyword Arguments: diff --git a/spectral/graphics/spywxpythonthread.py b/spectral/graphics/spywxpythonthread.py index 441535d..2b5de3c 100644 --- a/spectral/graphics/spywxpythonthread.py +++ b/spectral/graphics/spywxpythonthread.py @@ -1,7 +1,7 @@ ''' wxWindows code which executes in a separate thread from the main thread -This module handles disply of images and related events. +This module handles display of images and related events. ''' from __future__ import absolute_import, division, print_function, unicode_literals diff --git a/spectral/image.py b/spectral/image.py index 311332e..328be06 100644 --- a/spectral/image.py +++ b/spectral/image.py @@ -123,11 +123,11 @@ def read_band(self, band): return np.asarray(self[:, :, band].squeeze()) def read_bands(self, bands): - '''For SpyFile compatibility. Equivlalent to arr.take(bands, 2)''' + '''For SpyFile compatibility. Equivalent to arr.take(bands, 2)''' return np.asarray(self.take(bands, 2)) def read_pixel(self, row, col): - '''For SpyFile compatibility. Equivlalent to arr[row, col]''' + '''For SpyFile compatibility. Equivalent to arr[row, col]''' return np.asarray(self[row, col]) def read_subregion(self, row_bounds, col_bounds, bands=None): @@ -158,7 +158,7 @@ def read_subimage(self, rows, cols, bands=None): return np.asarray(self[rows][:, cols]) def read_datum(self, i, j, k): - '''For SpyFile compatibility. Equivlalent to arr[i, j, k]''' + '''For SpyFile compatibility. Equivalent to arr[i, j, k]''' return self[i, j, k] def load(self): diff --git a/spectral/io/bilfile.py b/spectral/io/bilfile.py index 4c138a8..020051b 100644 --- a/spectral/io/bilfile.py +++ b/spectral/io/bilfile.py @@ -198,7 +198,7 @@ def read_subregion(self, row_bounds, col_bounds, bands=None, `col_bounds` (2-tuple of ints): - (a, b) -> Columnss a through b-1 will be read. + (a, b) -> Columns a through b-1 will be read. `bands` (list of ints): diff --git a/spectral/io/bipfile.py b/spectral/io/bipfile.py index fa4f4b3..62a0455 100644 --- a/spectral/io/bipfile.py +++ b/spectral/io/bipfile.py @@ -200,7 +200,7 @@ def read_subregion(self, row_bounds, col_bounds, bands=None, `col_bounds` (2-tuple of ints): - (a, b) -> Columnss a through b-1 will be read. + (a, b) -> Columns a through b-1 will be read. `bands` (list of ints): diff --git a/spectral/io/bsqfile.py b/spectral/io/bsqfile.py index dc8ae29..0e81123 100644 --- a/spectral/io/bsqfile.py +++ b/spectral/io/bsqfile.py @@ -199,7 +199,7 @@ def read_subregion(self, row_bounds, col_bounds, bands=None, `col_bounds` (2-tuple of ints): - (a, b) -> Columnss a through b-1 will be read. + (a, b) -> Columns a through b-1 will be read. `bands` (list of ints): diff --git a/spectral/io/envi.py b/spectral/io/envi.py index 4fa4b47..7b420b2 100644 --- a/spectral/io/envi.py +++ b/spectral/io/envi.py @@ -230,7 +230,7 @@ def _has_frame_offset(params): `params` (dict): - Dictionary of header parameters assocaited with hdr file. + Dictionary of header parameters associated with hdr file. Returns: @@ -737,7 +737,7 @@ def create_image(hdr_file, metadata=None, **kwargs): `interleave` (str): - Must be one of "bil", "bip", or "bsq". This keyword supercedes the + Must be one of "bil", "bip", or "bsq". This keyword supersedes the value of "interleave" in the metadata argument, if given. If no interleave is specified (via keyword or `metadata`), "bip" is assumed. @@ -748,14 +748,14 @@ def create_image(hdr_file, metadata=None, **kwargs): This keyword should be either of the form (R, C, B) or (R, C), where R, C, and B specify the number or rows, columns, and bands, respectively. If B is omitted, the number of bands is assumed to - be one. If this keyword is given, its values supercede the values + be one. If this keyword is given, its values supersede the values of "bands", "lines", and "samples" if they are present in the `metadata` argument. `offset` (integer, default 0): The offset (in bytes) of image data from the beginning of the file. - This value supercedes the value of "header offset" in the metadata + This value supersedes the value of "header offset" in the metadata argument (if given). Returns: @@ -801,7 +801,7 @@ def create_image(hdr_file, metadata=None, **kwargs): default_metadata.update(metadata) metadata = default_metadata - # Keyword args supercede metadata dict + # Keyword args supersede metadata dict if 'shape' in kwargs: shape = kwargs['shape'] metadata['lines'] = shape[0] diff --git a/spectral/io/spyfile.py b/spectral/io/spyfile.py index 96b0c2a..98961e4 100644 --- a/spectral/io/spyfile.py +++ b/spectral/io/spyfile.py @@ -98,7 +98,7 @@ class FileNotFoundError(SpyException): class InvalidFileError(SpyException): - '''Raised when file contents are invalid for the exepected file type.''' + '''Raised when file contents are invalid for the expected file type.''' pass @@ -520,7 +520,7 @@ def read_subregion(self, row_bounds, col_bounds, bands=None): `col_bounds` (2-tuple of ints): - (a, b) -> Columnss a through b-1 will be read. + (a, b) -> Columns a through b-1 will be read. `bands` (list of ints): @@ -548,7 +548,7 @@ def tile_image(im, nrows, ncols): ARGUMENTS: im The SpyFile to tile. - nrows Number of tiles in the veritical direction. + nrows Number of tiles in the vertical direction. ncols Number of tiles in the horizontal direction. RETURN VALUE: diff --git a/spectral/tests/envi.py b/spectral/tests/envi.py index 430af13..fdd7609 100644 --- a/spectral/tests/envi.py +++ b/spectral/tests/envi.py @@ -40,7 +40,7 @@ def setup(self): os.makedirs(testdir) def test_save_image_ndarray(self): - '''Test saving an ENVI formated image from a numpy.ndarray.''' + '''Test saving an ENVI formatted image from a numpy.ndarray.''' (R, B, C) = (10, 20, 30) (r, b, c) = (3, 8, 23) datum = 33 @@ -52,7 +52,7 @@ def test_save_image_ndarray(self): assert_almost_equal(img[r, b, c], datum) def test_save_image_ndarray_no_ext(self): - '''Test saving an ENVI formated image with no image file extension.''' + '''Test saving an ENVI formatted image with no image file extension.''' data = np.arange(1000, dtype=np.int16).reshape(10, 10, 10) base = os.path.join(testdir, 'test_save_image_ndarray_noext') hdr_file = base + '.hdr' @@ -61,7 +61,7 @@ def test_save_image_ndarray_no_ext(self): assert (np.all(data == rdata)) def test_save_image_ndarray_alt_ext(self): - '''Test saving an ENVI formated image with alternate extension.''' + '''Test saving an ENVI formatted image with alternate extension.''' data = np.arange(1000, dtype=np.int16).reshape(10, 10, 10) base = os.path.join(testdir, 'test_save_image_ndarray_alt_ext') hdr_file = base + '.hdr'