diff --git a/README.rst b/README.rst index 52f61dbfa..296818e5a 100755 --- a/README.rst +++ b/README.rst @@ -38,7 +38,7 @@ Getting this Code .. image:: https://i.imgur.com/h4mWwM0.png :target: https://www.youtube.com/watch?v=uZ_yKs11W18 - :alt: Introduction and Installation Guide to Stoner Pythin Package + :alt: Introduction and Installation Guide to Stoner Python Package :width: 320 Anaconda Python is the recommended distribution of python and the conda packages are the preferred packaging system for @@ -48,8 +48,8 @@ be obtained from the `phygbu` channel (although for full functionality, other pa Compatibility -------------- -Version 0.10.x is compatbile with Python 3.9-3.13. Version 0.11.x (currently in development) will be compatible with -Python 3.11-3.13 and will add support for 3.14 when it is supported within the Anaconda distrubtion. +Version 0.10.x is compatible with Python 3.9-3.13. Version 0.11.x (currently in development) will be compatible with +Python 3.11-3.13 and will add support for 3.14 when it is supported within the Anaconda distribution. The last version that supported Python 2.7 was 0.9.x @@ -124,7 +124,7 @@ ImageFile --------- **Stoner.ImageFile** is the top-level class for managing image data. It is the equivalent of **Stoner.Data** and maintains -metadta and comes with a number of methods to manipulate image data. The image data is stored internally as a masked numpy +metadata and comes with a number of methods to manipulate image data. The image data is stored internally as a masked numpy array and where possible the masking is taken into account when carrying out image analysis tasks. Through some abuse of the Python class system, functions in the scpy.ndimage and scikit-image modules are mapped into methods of the ImageFile class allowing a very rich set of operations on the data sets. The default IO methods handle tiff and png images and can @@ -137,7 +137,7 @@ DataFolder structure. It provides methods to list. filter and group data according to filename patterns or metadata and then to execute a function on each file or group of files and then collect metadata from each file in turn. A key feature of DataFolder is its ability to work with the collated metadata from the individual files that are held in the DataFolder. -In combination with its ability to walk through a complete heirarchy of groups of +In combination with its ability to walk through a complete hierarchy of groups of **Data** objects, the handling of the common metadata provides powerful tools for quickly writing data reduction scripts. ImageFolder @@ -159,8 +159,8 @@ Other Modules and Classes ------------------------- The **Stoner.HDF5** module provides some additional classes to manipulate *Data* and *DataFolder* objects within HDF5 -format files. HDF5 is a common chouse for storing data from large scale facilties, although providing a way to handle -arbitary HDF5 files is beyond the scope of this package at this time - the format is much too complex and flexible to make that +format files. HDF5 is a common choice for storing data from large scale facilities, although providing a way to handle +arbitrary HDF5 files is beyond the scope of this package at this time - the format is much too complex and flexible to make that an easy task. Rather it provides a way to work with large numbers of experimental sets using just a single file which may be less brutal to your computer's OS than having directory trees with millions of individual files. @@ -227,7 +227,7 @@ Online documentation for all versions can be found on the ReadTheDocs pages `onl Version 0.11 is the current (in development) stable release (i.e. releases pass all unit tests.) New features include: - * Move away from mixin classes and multiple inheritence to dynamically binding functions into the class from + * Move away from mixin classes and multiple inheritance to dynamically binding functions into the class from modules. * Continued restructuring of the class layout and rationalisation of the naming conventions. @@ -242,7 +242,7 @@ Version 0.10 is the old stable release. New Features in 0.10 include: dictionary with methods to prune and filter in the virtual tree of sub-folders. * Refactoring of the **ImageArray** and **ImageFile** so that binding of external functions as methods is done at class definition time rather than at runtime with overly complex __getattr__ methods. The longer term goal is to - depricate the use of ImageArray in favour of just using ImageFile. + deprecate the use of ImageArray in favour of just using ImageFile. * Introduce interactive selection of boxes, lines and mask regions for interactive Matplotlib backends. * Fix some long standing bugs which could lead to shared metadata dictionaries and race conditions @@ -271,7 +271,7 @@ Version 0.8 is the ancient release. The main new features were: 0.8.2 was the final release of the 0.8.0 branch -No further relases will be made to 0.8.x - 0.10.x +No further releases will be made to 0.8.x - 0.10.x Versions 0.7.x and earlier are now pre-historic! diff --git a/Stoner/Image/attrs.py b/Stoner/Image/attrs.py index 4790229b7..80544fe51 100755 --- a/Stoner/Image/attrs.py +++ b/Stoner/Image/attrs.py @@ -230,7 +230,7 @@ class MaskProxy: The string representation of the mask is an ascii art version of the mask where . is unmasked and X is masked. - Conversion to a boolean is equaivalent to testing whether **any** elements of the mask are True. + Conversion to a boolean is equivalent to testing whether **any** elements of the mask are True. The mask also supports the invert and negate operators which both return the inverse of the mask (but do not change the mask itself - unlike :py:meth:`MaskProxy.invert`). @@ -367,7 +367,7 @@ def select(self, **kwargs): - left-clicking the mouse sets a new vertex - right-clicking the mouse removes the last set vertex - pressing "i" inverts the mask (i.e. controls whether the shape the user is drawing is masked or clear) - - pressing "p" sets polygon mode (the default) - each vertex is then the corener of a polygon. The + - pressing "p" sets polygon mode (the default) - each vertex is then the corner of a polygon. The polygon vertices are defined in order going around the shape. - pressing "r" sets rectangular mode. The first vertex defined is one corner. With only two vertices the diff --git a/Stoner/Image/core.py b/Stoner/Image/core.py index 9ae69cb20..d4dba2a90 100755 --- a/Stoner/Image/core.py +++ b/Stoner/Image/core.py @@ -212,7 +212,7 @@ class ImageArray(np.ma.MaskedArray, metadataObject): The title of the image (defaults to the filename). mask (:py:class:`numpy.ndarray of bool`): The underlying mask data of the image. Masked elements (i.e. where mask=True) are ignored for many - image operations. Indexing them will return the mask fill value (typically NaN, ot -1 or -MAXINT) + image operations. Indexing them will return the mask fill value (typically NaN, or -1 or -MAXINT) draw (:py:class:`Stoner.Image.attrs.DrawProxy`): A special object that allows the user to manipulate the image data by making use of :py:mod:`skimage.draw` functions as well as some additional drawing functions. @@ -1184,7 +1184,7 @@ def get_filename(self, mode): @classmethod def load(cls, *args, **kwargs): - """Create a :py:class:`ImageFile` from file abnd guessing a better subclass if necessary. + """Create a :py:class:`ImageFile` from file and guessing a better subclass if necessary. Args: filename (string or None): diff --git a/Stoner/Image/imagefuncs.py b/Stoner/Image/imagefuncs.py index 916540dc5..47281cfda 100755 --- a/Stoner/Image/imagefuncs.py +++ b/Stoner/Image/imagefuncs.py @@ -399,7 +399,7 @@ def convert(image, dtype, force_copy=False, uniform=False, normalise=True): elif ( dtypeobj_in.itemsize <= dtypeobj.itemsize and dtypeobj.itemsize == 8 ): # f64->int64 needs care to avoid overruns! - image *= 2**54 # float64 has 52bits of mantissa, so this will avoid precission loss for a +/-1 range + image *= 2**54 # float64 has 52bits of mantissa, so this will avoid precision loss for a +/-1 range np.rint(image, out=image) image = image.astype(dtype) np.clip(image, -(2**54), 2**54 - 1, out=image) @@ -581,7 +581,7 @@ def gridimage(im, points=None, xi=None, method="linear", fill_value=None, rescal Image data to be worked with. points (tuple of (x-co-ords,yco-ordsa)): The actual sampled data coordinates - xi (tupe of (2D array,2D array)): + xi (tuple of (2D array,2D array)): The regular grid coordinates (as generated by e.g. :py:func:`np.meshgrid`) Keyword Arguments: @@ -673,7 +673,7 @@ def imshow( mask_alpha (float,None): Alpha of mask to use mask_color (matplotlib colour): - Colour of masked regons - defaults to red. + Colour of masked regions - defaults to red. **kwargs: Other keywords are passed to imshow() @@ -969,7 +969,7 @@ def fix(x, mx): def radial_coordinates(im, centre=(None, None), pixel_size=(1, 1), angle=False): - """Rerurn a map of the radial coordinates of an image from a given centre, with adjustments for pixel size. + """Return a map of the radial coordinates of an image from a given centre, with adjustments for pixel size. Args: im (ImargeArray,ImageFile): @@ -1602,7 +1602,7 @@ def save(image, filename=None, **kwargs): integer data will be converted to np.float32 type for saving. if forcetype then preserve and save as int type (will be unsigned). **kwargs: - Other keyword aruments + Other keyword arguments Notes: Metadata will be preserved in .png and .tif format. diff --git a/Stoner/Image/kerr.py b/Stoner/Image/kerr.py index 5c93513cf..9be44a9de 100755 --- a/Stoner/Image/kerr.py +++ b/Stoner/Image/kerr.py @@ -279,7 +279,7 @@ def HcMap( # pylint: disable=invalid-name the threshold value for the intensity switching. This will need to be tuned for each stack correct_drift(bol): - whether to correct drift on the image stack before proceding + whether to correct drift on the image stack before proceeding baseimage(int or ImageArray): we use drift correction from the baseimage. saturation_end(bool): @@ -287,7 +287,7 @@ def HcMap( # pylint: disable=invalid-name saturation_white(bool): bright pixels are saturated dark pixels are not yet switched quiet: bool - choose wether to output status updates as print messages + choose whether to output status updates as print messages extra_info(bool): choose whether to return intermediate calculation steps as an extra dictionary Returns: diff --git a/Stoner/Image/widgets.py b/Stoner/Image/widgets.py index 2ea47c762..5bcb5ee99 100755 --- a/Stoner/Image/widgets.py +++ b/Stoner/Image/widgets.py @@ -37,7 +37,7 @@ def _straight_ellipse(p, data): def _rotated_ellipse(p, data): - """Calcualte a rotated ellipse.""" + """Calculate a rotated ellipse.""" xc, yc, a, b, phi = p x, y = data.T t1 = ((x - xc) * np.cos(phi) + (y - yc) * np.sin(phi)) ** 2 / a**2 @@ -188,7 +188,7 @@ def __init__(self): self.kwargs = {} def __call__(self, image, **kwargs): - """Actuall do the region selection. + """Actually do the region selection. Args: image (ImageArray, ImageFile): @@ -198,7 +198,7 @@ def __call__(self, image, **kwargs): Returns: list: - The x and y range coordinates, in te order left-x, right-x, top-y, bottom-y + The x and y range coordinates, in the order left-x, right-x, top-y, bottom-y """ self.fig = image.imshow() @@ -289,7 +289,7 @@ def __call__(self, image, **kwargs): Returns: mask_array: - A boolean array of te same shape as the image that can be used as a mask. + A boolean array of the same shape as the image that can be used as a mask. """ self.fig = image.imshow() @@ -379,7 +379,7 @@ def on_click(self, event): self.vertices.append((event.xdata, event.ydata)) else: self.finished = True - elif event.button == 3 and len(self.vertices) > 0: # Right click toi remove last vertex + elif event.button == 3 and len(self.vertices) > 0: # Right click to remove last vertex del self.vertices[-1] if len(self.vertices) == 0: self.ov_layer.set_array(np.zeros(self.shape + (4,))) diff --git a/Stoner/analysis/columns.py b/Stoner/analysis/columns.py index 0b3d0662c..201596001 100755 --- a/Stoner/analysis/columns.py +++ b/Stoner/analysis/columns.py @@ -57,7 +57,7 @@ def __get_math_val(datafile: Data, col: Index) -> Tuple[Data, str]: Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col (various): If col can be interpreted as col_a column index then return the first matching column. If col is col_a 1D array of the same length as the data then just return the data. If col is col_a @@ -97,7 +97,7 @@ def add( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col_a (index): First column to work with col_b (index, float or 1D array): @@ -148,7 +148,7 @@ def diffsum( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col_a (index): First column to work with col_b (index, float or 1D array): @@ -199,7 +199,7 @@ def divide( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col_a (index): First column to work with col_b (index, float or 1D array): @@ -244,7 +244,7 @@ def max( # pylint: disable=redefined-builtin Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in @@ -284,7 +284,7 @@ def mean( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in @@ -338,7 +338,7 @@ def min( # pylint: disable=redefined-builtin Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in @@ -380,7 +380,7 @@ def multiply( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col_a (index): First column to work with col_b (index, float or 1D array): @@ -424,7 +424,7 @@ def span(datafile: Data, column: Optional[Index] = None, bounds: Optional[Callab Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in @@ -457,7 +457,7 @@ def std( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in @@ -518,7 +518,7 @@ def subtract( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. col_a (index): First column to work with col_b (index, float or 1D array): diff --git a/Stoner/analysis/filtering.py b/Stoner/analysis/filtering.py index b0d73ec45..3aff64fcc 100755 --- a/Stoner/analysis/filtering.py +++ b/Stoner/analysis/filtering.py @@ -28,7 +28,7 @@ def _bin_weighted(x, y_vals, bin_edges, y_errs=None): Keyword Arguments: y_errs (2D array (N,m) floats or None): - uncertainities in y values. Default value is None in which case all vbalues equally weighted. + uncertainties in y values. Default value is None in which case all vbalues equally weighted. Returns: tuple[1D array of x, 2D array of y, 2D array of y_errs, binned_counts] @@ -72,7 +72,7 @@ def _bin_weighted(x, y_vals, bin_edges, y_errs=None): binned_y[:, j] = sum_yw / sum_w - # Calculate the weighted uncertainity + # Calculate the weighted uncertainty variance = (y_vals[:, j] - binned_y[:, j][bin_indices]) ** 2 variance_n = variance / binned_counts[:, j][bin_indices] * w / sum_w[bin_indices] @@ -1056,7 +1056,7 @@ def spline( result (bool or column index): Whether to add the smoothed data to the dataset and if so where. replace (Boolean or column index or None): - If True then the y-column data is repalced, if a column index then the + If True then the y-column data is replaced, if a column index then the new data is added after the specified index, if False then the new y-data is returned and if None, then spline object is returned. header (string): diff --git a/Stoner/analysis/fitting/classes.py b/Stoner/analysis/fitting/classes.py index 6630e5142..05f6336fc 100755 --- a/Stoner/analysis/fitting/classes.py +++ b/Stoner/analysis/fitting/classes.py @@ -278,7 +278,7 @@ def fit_values(self): @property def perr(self): - """Return standar error from covariance matrix.""" + """Return standard error from covariance matrix.""" if "perr" in self.results and self.results["perr"] is not None: return self.results["perr"] return np.sqrt(np.diag(self.pcov)) diff --git a/Stoner/analysis/fitting/functions.py b/Stoner/analysis/fitting/functions.py index 7d9b12592..ca03fcf13 100755 --- a/Stoner/analysis/fitting/functions.py +++ b/Stoner/analysis/fitting/functions.py @@ -542,7 +542,7 @@ def annotate_fit(datafile, model, x=None, y=None, z=None, text_only=False, mode= x = 0.75 if x is None else x y = 0.5 if y is None else y - try: # if the model has an attribute display params then use these as the parameter anmes + try: # if the model has an attribute display params then use these as the parameter names for k, display_name, unit in zip(param_names, display_names, units): if prefix: datafile[f"{prefix}{k} label"] = display_name @@ -755,10 +755,10 @@ def differential_evolution(datafile, model, xcol=None, ycol=None, p0=None, sigma model (lmfit_mod.Model): An instance of an lmfit_mod.Model that represents the model to be fitted to the data xcol (index or None): - Columns to be used for the x data for the fitting. If not givem defaults to the + Columns to be used for the x data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` x column ycol (index or None): - Columns to be used for the y data for the fitting. If not givem defaults to the + Columns to be used for the y data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` y column Keyword Arguments: @@ -907,10 +907,10 @@ def lmfit(datafile, model, xcol=None, ycol=None, p0=None, sigma=None, **kwargs): model (lmfit_mod.Model): An instance of an lmfit_mod.Model that represents the model to be fitted to the data xcol (index or None): - Columns to be used for the x data for the fitting. If not givem defaults to the + Columns to be used for the x data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` x column ycol (index or None): - Columns to be used for the y data for the fitting. If not givem defaults to the + Columns to be used for the y data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` y column Keyword Arguments: @@ -1088,10 +1088,10 @@ def odr(datafile, model, xcol=None, ycol=None, **kwargs): model (scipy.odr.Model, lmfit_mod.Models.Model or callable): The model that describes the data. See below for more details. xcol (index or None): - Columns to be used for the x data for the fitting. If not givem defaults to the + Columns to be used for the x data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` x column ycol (index or None): - Columns to be used for the y data for the fitting. If not givem defaults to the + Columns to be used for the y data for the fitting. If not given defaults to the :py:attr:`Stoner.Core.DataFile.setas` y column Keyword Arguments: diff --git a/Stoner/analysis/fitting/models/__init__.py b/Stoner/analysis/fitting/models/__init__.py index c6dd1b267..b45b59309 100755 --- a/Stoner/analysis/fitting/models/__init__.py +++ b/Stoner/analysis/fitting/models/__init__.py @@ -119,7 +119,7 @@ def hinter(cls, func): Args: func (callable): - A fimction that rturns a dictionary of dictionaries + A function that returns a dictionary of dictionaries Returns: The wrapped hinter function. diff --git a/Stoner/analysis/fitting/models/tunnelling.py b/Stoner/analysis/fitting/models/tunnelling.py index 3e09e3bcf..7ba0c2ff5 100755 --- a/Stoner/analysis/fitting/models/tunnelling.py +++ b/Stoner/analysis/fitting/models/tunnelling.py @@ -247,7 +247,7 @@ def __init__(self, *args, **kwargs): super().__init__(tersoffHammann, *args, **kwargs) def guess(self, data, x=None, **kwargs): - """Set the parameter values from an apporximate line.""" + """Set the parameter values from an approximate line.""" pars = self.make_params(A=np.mean(data / x)) return update_param_vals(pars, self.prefix, **kwargs) diff --git a/Stoner/analysis/functions.py b/Stoner/analysis/functions.py index cf2682a56..f6b857c29 100755 --- a/Stoner/analysis/functions.py +++ b/Stoner/analysis/functions.py @@ -24,7 +24,7 @@ def apply( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. func (callable): The function to apply to each row of the data. col (index): @@ -48,7 +48,7 @@ def apply( def func(row,**kwargs): - and should return either a single float, in which case it will be used to repalce the specified column, + and should return either a single float, in which case it will be used to replace the specified column, or an array, in which case it is used to completely replace the row of data. If the function returns a complete row of data, then the *replace* parameter will cause the return @@ -101,7 +101,7 @@ def clip(datafile: Data, clipper: Union[Tuple[float, float], NumericArray], colu Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. column (index): Column to look for the maximum in clipper (tuple or array): @@ -138,7 +138,7 @@ def decompose( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. Keyword Arguments: xcol (index): @@ -234,7 +234,7 @@ def integrate( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. xcol (index): The X data column index (or header) ycol (index): @@ -318,7 +318,7 @@ def normalise( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. Keyword Arguments: target (index): @@ -399,7 +399,7 @@ def stitch( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. other (DataFile): Another data set that is used as the base to stitch this one on to xcol (index or None): @@ -554,7 +554,7 @@ def threshold( Args: datafile (Data): - If not being used as a bound menthod, specifies the instance of Data to work with. + If not being used as a bound method, specifies the instance of Data to work with. threshold (float): Value to look for in column col diff --git a/Stoner/analysis/utils.py b/Stoner/analysis/utils.py index 406e798e3..17ab85fec 100755 --- a/Stoner/analysis/utils.py +++ b/Stoner/analysis/utils.py @@ -55,7 +55,7 @@ def poly_outlier(row, window, metric=3.0, ycol=None, xcol=None, order=1, yerr=No Keyyword Arguments: metric (float): - Some measure of how sensitive the dection should be + Some measure of how sensitive the detection should be xcol (column index): Column of data to use for X values. Defaults to current setas value order (int): @@ -441,7 +441,7 @@ def split_up_down(data, col=None, folder=None): Args: data (:py:class:`Stoner.Core.DataFile`): - object containign the data to be sorted + object containing the data to be sorted col (index): is something that :py:meth:`Stoner.Core.DataFile.find_col` can use folder (:py:class:`Stoner.Folders.DataFolder` or None): diff --git a/Stoner/compat.py b/Stoner/compat.py index 25ad995c2..065ddd546 100755 --- a/Stoner/compat.py +++ b/Stoner/compat.py @@ -193,5 +193,5 @@ def __call__(self, *args, **kwargs): return self.jit def __getitem__(self, *args, **kwargs): - """Hande jit calls to array types.""" + """Handle jit calls to array types.""" return self diff --git a/Stoner/core/array.py b/Stoner/core/array.py index f1bc90100..a4c228f07 100755 --- a/Stoner/core/array.py +++ b/Stoner/core/array.py @@ -83,7 +83,7 @@ def __new__(cls, input_array, *args, **kwargs): # Finally, we must return the newly created object: obj.i = i obj.setas._row = _row and obj.ndim == 1 - # Set shared mask - stops some deprication warnings + # Set shared mask - stops some deprecation warnings obj.unshare_mask() if np.issubdtype(obj.dtype, np.floating): obj.fill_value = np.nan diff --git a/Stoner/core/base.py b/Stoner/core/base.py index d1ca00929..6e9b43c37 100755 --- a/Stoner/core/base.py +++ b/Stoner/core/base.py @@ -70,7 +70,7 @@ def string_to_type(value: str) -> Any: First of all the first character is checked to see if it is a [ or { which would suggest this is a list of dictionary. If the value looks like a common boolean - value (i.e. Yes, No, True, Fale, On, Off) then it is assumed to be a boolean value. + value (i.e. Yes, No, True, False, On, Off) then it is assumed to be a boolean value. Finally it interpretation as an int, float or string is tried. Args: @@ -765,7 +765,7 @@ def _matching(cls, val: Tuple[int, str] | List[Tuple[int, str]]) -> List[Tuple[i case list(): return [] case _: - raise TypeError("Can only add items that are a typle of int,value") + raise TypeError("Can only add items that are a tuple of int,value") def get_value_list(self, name): """Get the values stored in the dictionary under name.""" diff --git a/Stoner/core/data.py b/Stoner/core/data.py index b9d529d1c..6e25d5242 100755 --- a/Stoner/core/data.py +++ b/Stoner/core/data.py @@ -544,7 +544,7 @@ def __setattr__(self, name, value): Name of attribute to set. Details of possible attributes below: - mask Passes through to the mask attribute of self.data (which is a numpy masked array). Also handles the case where you pass a callable object to nask where we pass each row to the - function and use the return reult as the mask + function and use the return result as the mask - data Ensures that the :py:attr:`data` attribute is always a :py:class:`numpy.ma.maskedarray` """ if hasattr(type(self), name) and isinstance(getattr(type(self), name), property): @@ -640,7 +640,7 @@ def _load(self, filename, *args, **kwargs): Raised if the first row does not start with 'TDI Format 1.5' or 'TDI Format=1.0'. Note: - The *_load* methods shouldbe overridden in each child class to handle the process of loading data from + The *_load* methods should be overridden in each child class to handle the process of loading data from disc. If they encounter unexpected data, then they should raise StonerLoadError to signal this, so that the loading class can try a different sub-class instead. """ @@ -699,7 +699,7 @@ def _load(self, filename, *args, **kwargs): return self def __repr_core__(self, shorten=1000): - """Actuall do the repr work, but allow for a shorten parameter to save printing big files out to disc.""" + """Actually do the repr work, but allow for a shorten parameter to save printing big files out to disc.""" outp = "TDI Format 1.5\t" + "\t".join(self.column_headers) + "\n" m = len(self.metadata) self.data = np.atleast_2d(self.data) @@ -832,9 +832,9 @@ def _set_mask(self, func, invert=False, cumulative=False, col=0): func (callable): A Callable object of the form lambda x:True where x is a row of data (numpy invert (bool): - Optionally invert te reult of the func test so that it unmasks data instead + Optionally invert the result of the func test so that it unmasks data instead cumulative (bool): - if tru, then an unmask value doesn't unmask the data, it just leaves it as it is. + if true, then an unmask value doesn't unmask the data, it just leaves it as it is. """ i = -1 args = len(_inspect_.getargs(func.__code__)[0]) diff --git a/Stoner/core/interfaces.py b/Stoner/core/interfaces.py index cd7e7dca8..c8a915519 100755 --- a/Stoner/core/interfaces.py +++ b/Stoner/core/interfaces.py @@ -38,7 +38,7 @@ def __delitem__(self, item): self.del_rows(item) def __getitem__(self, name): - """Return either a row or iterm of metadata. + """Return either a row or item of metadata. Args: name (string or slice or int): @@ -127,7 +127,7 @@ def __setitem__(self, name, value): Notes: If name is a string or already exists as key in metadata, this setitem will set metadata values, otherwise if name is a tuple then if the first elem,ent in a string it checks to see if that is an - existing metadata item that is iterable, and if so, sets the metadta. In all other circumstances, + existing metadata item that is iterable, and if so, sets the metadata. In all other circumstances, it attempts to set an item in the main data array. """ match name: diff --git a/Stoner/core/methods.py b/Stoner/core/methods.py index 077b13605..a4fef947d 100755 --- a/Stoner/core/methods.py +++ b/Stoner/core/methods.py @@ -272,7 +272,7 @@ def rolling_window(datafile, window=7, wrap=True, exclude_centre=False): raise ValueError("If excluding the centre of the window, this must be an odd number of rows.") if window - exclude_centre < 2 or window < 3 or window % 2 == 0: raise ValueError( - """Window must be at least two bigger than the number of rows exluded from the centre, bigger than + """Window must be at least two bigger than the number of rows excluded from the centre, bigger than 3 and odd""" ) @@ -445,7 +445,7 @@ def select(datafile, *args, **kwargs): (DatFile): a copy the DataFile instance that contains just the matching rows. Note: - if the operator is preceeded by *__not__* then the sense of the test is negated. + if the operator is preceded by *__not__* then the sense of the test is negated. If any of the tests is True, then the row will be selected, so the effect is a logical OR. To achieve a logical AND, you can chain two selects together:: @@ -517,7 +517,7 @@ def sort(datafile, *order, reverse=False): A copy of the :py:class:`DataFile` sorted object Notes: - Sorts in place and returns a copy of the sorted data object fo chaining methods. + Sorts in place and returns a copy of the sorted data object for chaining methods. If the argument is a callable function then it should take a two tuple arguments and return +1,0,-1 depending on whether the first argument is bigger, equal or smaller. Otherwise @@ -973,7 +973,7 @@ def del_rows(datafile, col=None, val=None, invert=False): True, then the row will be deleted or kept depending on the value of *invert*. If *val* is a callable it should take two arguments - a float and a - list. The float is the value of the current row that corresponds to column col abd the second + list. The float is the value of the current row that corresponds to column col and the second argument is the current row. Todo: diff --git a/Stoner/folders/core.py b/Stoner/folders/core.py index 47fc807a5..bd3e8c926 100755 --- a/Stoner/folders/core.py +++ b/Stoner/folders/core.py @@ -171,7 +171,7 @@ class BaseFolder(MutableSequence): A data structure that indicates the structure of the objectFolder - tuple of number of files and dictionary of the shape of each group. type (subclass of metadtaObject): - The class of objects sotred in this folder + The class of objects stored in this folder Notes: A BaseFolder is a multable sequence object that should store a mapping of instances of some sort of data diff --git a/Stoner/folders/groups.py b/Stoner/folders/groups.py index d374c7f8e..212197acd 100755 --- a/Stoner/folders/groups.py +++ b/Stoner/folders/groups.py @@ -80,7 +80,7 @@ def prune(self, name=None): """Remove any empty groups from the objectFolder (and subgroups). Returns: - A copy of thte pruned objectFolder. + A copy of the pruned objectFolder. """ keys = list(self.keys()) for grp in keys: diff --git a/Stoner/folders/methods.py b/Stoner/folders/methods.py index d07ce3e50..cc576a335 100755 --- a/Stoner/folders/methods.py +++ b/Stoner/folders/methods.py @@ -125,7 +125,7 @@ def compress(fldr, base=None, key=".", keep_terminal=False): default None key (str): default "." - keep_terminal (gool): + keep_terminal (bool): default False Returns: @@ -556,7 +556,7 @@ def prune(fldr, name=None): """Remove any empty groups from the objectFolder (and subgroups). Returns: - A copy of thte pruned objectFolder. + A copy of the pruned objectFolder. """ return fldr.groups.prune(name=name) @@ -577,7 +577,7 @@ def select(fldr, *args, **kwargs): Keyword Arguments: recurse (bool): - Also recursively slect through the sub groups + Also recursively select through the sub groups kwargs (varuous): Arbitrary keyword arguments are interpreted as requestion matches against the corresponding metadata values. The keyword argument may have an additional **__operator** appended to it which is diff --git a/Stoner/folders/mixins.py b/Stoner/folders/mixins.py index 0650d050f..72a3862e6 100755 --- a/Stoner/folders/mixins.py +++ b/Stoner/folders/mixins.py @@ -195,7 +195,7 @@ def _save(self, grp, trail, root=None): called from the public save() method. The trail of group keys is used to create a directory tree. Args: - grp (:py:class:`objectFolder` or :py:calss:`Stoner.metadataObject`): + grp (:py:class:`objectFolder` or :py:class:`Stoner.metadataObject`): A group or file to save trail (list of strings): the trail of paths used to get here root (string or None): a replacement root directory @@ -402,7 +402,7 @@ def keep_latest(self): The CM group LabVIEW software will avoid overwriting files when measuring by inserting !#### where #### is an integer revision number just before the filename extension. This method will look for instances of several - files which differ in name only by the presence of the revision number and will kepp only the highest revision + files which differ in name only by the presence of the revision number and will keep only the highest revision number. This is useful if several measurements of the same experiment have been carried out, but only the last file is the correct one. @@ -476,7 +476,7 @@ def unload(self, name=None): class DataFolder(DiskBasedFolderMixin, BaseFolder): """Provide an interface to manipulating lots of data files stored within a directory structure on disc. - By default, the members of the DataFolder are instances of :class:`Stoner.Data`. The DataFolder emplys a lazy + By default, the members of the DataFolder are instances of :class:`Stoner.Data`. The DataFolder employs a lazy open strategy, so that files are only read in from disc when actually needed. .. inheritance-diagram:: DataFolder diff --git a/Stoner/folders/utils.py b/Stoner/folders/utils.py index e2028bc22..48e40dae2 100755 --- a/Stoner/folders/utils.py +++ b/Stoner/folders/utils.py @@ -81,7 +81,7 @@ def filter_files(files, patterns, keep=True): Args: files (list of str): Filename to filter - pattens (list of (str,regular expressions): List of patterns to consider + patterns (list of (str,regular expressions): List of patterns to consider Keyword Arguments: keep (bool): True (default) to keep matching files. diff --git a/Stoner/formats/attocube.py b/Stoner/formats/attocube.py index dc3a7979b..bba42d35e 100755 --- a/Stoner/formats/attocube.py +++ b/Stoner/formats/attocube.py @@ -470,7 +470,7 @@ def read_hdf5(cls, filename, *args, **kwargs): channels = [] grps = list(f.keys()) if "common_metadata" not in grps or "common_typehints" not in grps: - _raise_error(f, message="Couldn;t find common metadata groups, something is not right here!") + _raise_error(f, message="Couldn't find common metadata groups, something is not right here!") metadata = f["common_metadata"].attrs typehints = f["common_typehints"].attrs for i in sorted(metadata): diff --git a/Stoner/formats/data/facilities.py b/Stoner/formats/data/facilities.py index d8359610c..1400da08d 100755 --- a/Stoner/formats/data/facilities.py +++ b/Stoner/formats/data/facilities.py @@ -45,7 +45,7 @@ def _bnl_find_lines(new_data): def _bnl_get_metadata(new_data): - """Load metadta from file. + """Load metadata from file. Metadata found is scan number 'Snumber', scan type and parameters 'Stype', scan date/time 'Sdatetime' and z motor position 'Smotor'. diff --git a/Stoner/formats/data/generic.py b/Stoner/formats/data/generic.py index 3829a278d..0819ab79e 100755 --- a/Stoner/formats/data/generic.py +++ b/Stoner/formats/data/generic.py @@ -106,7 +106,7 @@ def load_tdi_format(new_data: Data, *args: Args, **kwargs: Kwargs) -> Data: Raised if the first row does not start with 'TDI Format 1.5' or 'TDI Format=1.0'. Note: - The *_load* methods shouldbe overridden in each child class to handle the process of loading data from + The *_load* methods should be overridden in each child class to handle the process of loading data from disc. If they encounter unexpected data, then they should raise StonerLoadError to signal this, so that the loading class can try a different sub-class instead. """ diff --git a/Stoner/formats/data/instruments.py b/Stoner/formats/data/instruments.py index 51a8c6866..b5ef63f1c 100755 --- a/Stoner/formats/data/instruments.py +++ b/Stoner/formats/data/instruments.py @@ -253,7 +253,7 @@ def load_qdfile(new_data, *args, **kwargs): def _to_Q(new_data, wavelength=1.540593): - """Add an additional function to covert an angualr scale to momentum transfer. + """Add an additional function to convert an angular scale to momentum transfer. Returns: a copy of itnew_data. diff --git a/Stoner/formats/data/zip.py b/Stoner/formats/data/zip.py index 8023fbacc..05e40c4ae 100755 --- a/Stoner/formats/data/zip.py +++ b/Stoner/formats/data/zip.py @@ -170,7 +170,7 @@ def save(save_data: Data, *args: Args, **kwargs: Kwargs) -> Data: Other keyword arguments are passed to get_filename to work out the filename. Returns: - A copy of the isntance of Data that was saved. + A copy of the instance of Data that was saved. """ filename, args, kwargs = get_filename(args, kwargs) compression = kwargs.pop("compression", zf.ZIP_DEFLATED) diff --git a/Stoner/formats/decorators.py b/Stoner/formats/decorators.py index 705fcb456..a3ab45f25 100755 --- a/Stoner/formats/decorators.py +++ b/Stoner/formats/decorators.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"""Decoiratoprs for manging loader and saver functions.""" +"""Decorators for managing loader and saver functions.""" from inspect import _empty, signature from typing import Callable, List, Optional, Tuple @@ -43,7 +43,7 @@ def register_loader( """ def innner(func: Callable) -> Callable: - """Actual decorator for laoder functions. + """Actual decorator for loader functions. Args: func (callable): @@ -86,10 +86,10 @@ def innner(func: Callable) -> Callable: match pattern: # Like mime-type, accept tuple or pattern, priority or just string pattern case (str(pattern), int(p)): _loaders_by_pattern[pattern] = (p, func) - case str(pattern): # Bare pattenr - use gloabl priority + case str(pattern): # Bare pattern - use global priority _loaders_by_pattern[pattern] = (func.priority, func) case _: # Unrecognised - raise TypeError("Pattern shpuld be either a str or (str, int)") + raise TypeError("Pattern should be either a str or (str, int)") # All loaders register on the default _loaders_by_pattern["*"] = (func.priority, func) _loaders_by_name[inner_name] = func @@ -121,7 +121,7 @@ def register_saver( """ def innner(func: Callable) -> Callable: - """Actual decorator for laoder functions. + """Actual decorator for loader functions. Args: func (callable): @@ -150,10 +150,10 @@ def innner(func: Callable) -> Callable: match pattern: # Like mime-type, accept tuple or pattern, priority or just string pattern case (str(pattern), int(p)): _savers_by_pattern[pattern] = (p, func) - case str(pattern): # Bare pattenr - use gloabl priority + case str(pattern): # Bare pattern - use global priority _savers_by_pattern[pattern] = (func.priority, func) case _: # Unrecognised - raise TypeError("Pattern shpuld be either a str or (str, int)") + raise TypeError("Pattern should be either a str or (str, int)") # All savers register on the default _savers_by_pattern["*"] = (func.priority, func) _savers_by_name[inner_name] = func diff --git a/Stoner/formats/maximus.py b/Stoner/formats/maximus.py index cdfe72232..dd97a0e20 100755 --- a/Stoner/formats/maximus.py +++ b/Stoner/formats/maximus.py @@ -233,7 +233,7 @@ def read_hdf5(cls, *args, **kwargs): names = [] grps = list(f.keys()) if "common_metadata" not in grps or "common_typehints" not in grps: - _raise_error(f, message="Couldn;t find common metadata groups, something is not right here!") + _raise_error(f, message="Couldn't find common metadata groups, something is not right here!") metadata = f["common_metadata"].attrs typehints = f["common_typehints"].attrs for i in sorted(metadata): diff --git a/Stoner/plot/core.py b/Stoner/plot/core.py index 28aa33a40..57bbebba5 100755 --- a/Stoner/plot/core.py +++ b/Stoner/plot/core.py @@ -69,7 +69,7 @@ class PlotMixin: Nothing (None) subplots (list of matplotlib.Axes): essentially the same as :py:attr:`PlotMixin.axes` but ensures that the list of subplots is - synchronised to the number fo Axes. + synchronised to the number of Axes. template (:py:class:`Sonter.plot.formats.DefaultPlotStyle` or instance): A plot style template subclass or object that determines the format and appearance of plots. """ diff --git a/Stoner/plot/formats.py b/Stoner/plot/formats.py index f474963f8..19a0563d4 100755 --- a/Stoner/plot/formats.py +++ b/Stoner/plot/formats.py @@ -412,7 +412,7 @@ def update(self, other=(), /, **_): pass case _: raise SyntaxError( - "Only one posotional argument which should be a Mapping subclass can be supplied toi update." + "Only one positional argument which should be a Mapping subclass can be supplied to update." ) def _compute_figsize(self): diff --git a/Stoner/tools/decorators.py b/Stoner/tools/decorators.py index 5f80f0cf3..620056099 100755 --- a/Stoner/tools/decorators.py +++ b/Stoner/tools/decorators.py @@ -308,7 +308,7 @@ def class_modifier( The factor function that takes the module function and produces a method that will call the function and take care of adapting the result. transpose (bool): - Whether ther functions in the module need to have their data transposed to work. + Whether there functions in the module need to have their data transposed to work. overload (bool): If False, don't overwrite the existing method.' proxy (class,None): diff --git a/Stoner/tools/file.py b/Stoner/tools/file.py index f0ae36bca..2f18cacde 100755 --- a/Stoner/tools/file.py +++ b/Stoner/tools/file.py @@ -280,7 +280,7 @@ def next_filer( Keyword Args: pattern (str, None): - (deault None) - if the file to load has an extension, use this. + (default None) - if the file to load has an extension, use this. mime-type (str,None): (default None) - if we have a mime-type for the file, use this. what (str, None): @@ -294,9 +294,9 @@ def next_filer( The next loader function to try. Notes: - If avaialbe, iterate through all loaders that match that particular mime-type, but also match the pattern + If available, iterate through all loaders that match that particular mime-type, but also match the pattern if it is available (which is should be!). If mime-type is not specified, then just match by pattern and if - neither are specified, then yse the default no pattern "*". + neither are specified, then use the default no pattern "*". """ if mode == "save": cache_by_type = {} @@ -345,7 +345,7 @@ def dialog_patterns(pattern: str = "*", name: Optional[str] = None, what: str = def best_saver(filename: str, name: Optional[str], what: Optional[str] = None) -> Callable: - """Figure out the best saving routine registerd with the package.""" + """Figure out the best saving routine registered with the package.""" if name and name in _savers_by_name: return _savers_by_name[name] match filename: @@ -376,7 +376,7 @@ def get_loader(filetype, silent=False): Args: filetype (str): Filetype to get loader for. - silent (bool): If False (default) raise a StonerLoadError if filetype doesn't have a loade. + silent (bool): If False (default) raise a StonerLoadError if filetype doesn't have a loader. Returns: (callable): Matching loader. @@ -409,7 +409,7 @@ def get_saver(filetype, silent=False): Args: filetype (str): Filetype to get saver for. - silent (bool): If False (default) raise a Stonersaverror if filetype doesn't have a loade. + silent (bool): If False (default) raise a Stonersaverror if filetype doesn't have a loader. Returns: (callable): Matching saver. @@ -445,7 +445,7 @@ def clear_routine(name, loader=True, saver=True): Keyword Arguments: loader (bool): - Whether to remove tyhe loader (default True) + Whether to remove the loader (default True) saver (bool): Whether to remove the saver routne (default True) diff --git a/Stoner/tools/tests.py b/Stoner/tools/tests.py index 5d8d4d601..8d31eba3e 100755 --- a/Stoner/tools/tests.py +++ b/Stoner/tools/tests.py @@ -62,7 +62,7 @@ def all_size(iterator: IterableType, size: Optional[Union[int, Tuple]] = None) - def all_type(iterator: IterableType, typ: type) -> bool: - """Determine if an interable omnly contains a common type. + """Determine if an iterable only contains a common type. Arguments: iterator (Iterable): @@ -122,7 +122,7 @@ def iscomparable(v1, v2) -> bool: def isiterable(value: Any) -> bool: - """Chack to see if a value is iterable. + """Check to see if a value is iterable. Args: value : @@ -254,7 +254,7 @@ def __getattr__(self, name): get the class as an attribute in the module and return it. Also, set the type into the stored mapping. """ if name not in self._kwargs: - return AttributeError(f"{name} is not an attrbute or mapped class alias.") + return AttributeError(f"{name} is not an attribute or mapped class alias.") mod = self._kwargs[name] if isinstance(mod, str): parts = mod.split(".") diff --git a/doc/Stoner.rst b/doc/Stoner.rst index 084404989..71e7bbc2a 100755 --- a/doc/Stoner.rst +++ b/doc/Stoner.rst @@ -108,7 +108,7 @@ Image Classes ------------------------------------- -Folders pacakge - Collections Classes +Folders package - Collections Classes ------------------------------------- Main Classes diff --git a/doc/UserGuide/analysisfile.rst b/doc/UserGuide/analysisfile.rst index 42581b7a1..53b81e946 100755 --- a/doc/UserGuide/analysisfile.rst +++ b/doc/UserGuide/analysisfile.rst @@ -258,7 +258,7 @@ possible match to *scan1*. If *xcol* or *ycol* are not given then the default x :py:attr:`Stoner.Core.DataFile.setas` attribute. The *mode* keyword can be used to specify the types of scaling operations that are -to be allowed. The defaults are to shoft both x and y by an offset value and to rescale +to be allowed. The defaults are to shift both x and y by an offset value and to rescale the y data by some factor. If even more control of the transformation is needed, the *func* keyword and *p0* keyword can be used to provide an alternative transformation function and initial guesses to its parameters. The profotype for the transformation @@ -304,7 +304,7 @@ use some locally fitted spline function to interpolate with. The :py:meth:`Stone spline=d.spline("X-Data","Y-Data",order=2,smoothing=2.0,replace=None) The *order* keyword gives the polynomial order of the spline function being fitted. The *smoothing* factor determines how -closely the spline follows the data points, with a *smoothing*=0.0 being a strict interpolation. The *repalce* argument +closely the spline follows the data points, with a *smoothing*=0.0 being a strict interpolation. The *replace* argument controls what the return value from the :py:meth:`Stoner.Data.spline` method returns. IF *replace* is True or a column index, then the new data is added as a column of the Data, possibly replacing the current y-data. If *replace* is False, then the new y-data is returned, but the existing data is unmodified. Finally, if *replace* is None, then the @@ -312,7 +312,7 @@ the new y-data is returned, but the existing data is unmodified. Finally, if *re evaluate the spline at arbitrary locations, including extrapolating outside the range of the original x data. Extrapolation is, of course, a dangerous, operation when applied to data as it is essentially 'inventing' new data. -Extrapolating fromt he spline function, whislt possible, is a little tricky and in many cases the :py:meth:`Stoner.Data.extrapolate` +Extrapolating from the spline function, whilst possible, is a little tricky and in many cases the :py:meth:`Stoner.Data.extrapolate` method is likely to be more successful. :py:meth:`AbnalyseFile.extrapolate` works by fitting a function over a window in the data and using the fit function to predict nearby values. Where the new values lie within the range of data, this is strictly a form of interpolation and the window of data fitted to the extrpolation function is centred around the new x-data point. As diff --git a/doc/UserGuide/cookbook.rst b/doc/UserGuide/cookbook.rst index 912d6316c..30a48baa0 100755 --- a/doc/UserGuide/cookbook.rst +++ b/doc/UserGuide/cookbook.rst @@ -51,7 +51,7 @@ provides a handy way to correct some instrumental artifacts and measure properti print "Remanance = {}".format(e["Remenance"]) The keyword arguments provide options to turn on or off corrections to remove diamagnetic background (and offset in M), -and any offset in H (e.g. due to trapped flux in the magnetometer). The latter option is slightly dangerous aas it will +and any offset in H (e.g. due to trapped flux in the magnetometer). The latter option is slightly dangerous as it will also remove the effect of any eexhange bias that moves the coercive field. As well as performing the corrections, the code will add metadata items for: diff --git a/doc/UserGuide/curve_fitting.rst b/doc/UserGuide/curve_fitting.rst index a2aced5c7..45c68379c 100755 --- a/doc/UserGuide/curve_fitting.rst +++ b/doc/UserGuide/curve_fitting.rst @@ -100,7 +100,7 @@ he output of the three methods used to fit arbitrary functions depend on the ke A 1D numpy array of optimal values and standard errors interleaved (i.e. p_opt[0],p_error[0],p_opt[1],p_error[1]....) us returned. This is useful when analysing a large number of similar data sets in order to build a table of fitting results. - *output="report"* - A python object representing the fitting reult is returned. + A python object representing the fitting result is returned. - *output="data"* A copy for the data file itself is returned - this is most useful when used in conjunction with :py:class:`Stoner.DataFolder` - *oputput="full"* @@ -212,7 +212,7 @@ The return value from :py:meth:`Data.lmfit` is controlled by the *output* keywor instance. This contains all the information about the fit and fitting process. You can pass the model as a subclass of model, if you don't pass initial values either via the *p0* parameter or as keyword arguments, then the model's -*guess* method is called (e.g. :py:meth:`Stoner.analysis.fitting.models.thermal.Arrhenius.guess`) to determine parameters fromt he data. For example: +*guess* method is called (e.g. :py:meth:`Stoner.analysis.fitting.models.thermal.Arrhenius.guess`) to determine parameters from the data. For example: .. plot:: samples/lmfit_example.py :include-source: @@ -295,7 +295,7 @@ Tunnelling Electron Transport Models We also have a number of models for electron tunnelling processes built into the library in :py:mod:`Stoner.analysis.fitting.models.tunnelling`: .. currentmodule:: Stoner.analysis.fitting.models.tunnelling - - :py:class:`Simmons` - the Simmons model describes tunneling through a square barrer potential for the limit where the barrier height + - :py:class:`Simmons` - the Simmons model describes tunneling through a square barrier potential for the limit where the barrier height is comparable to the junction bias. - :py:class:`BDR` - this model introduces a trapezoidal barrier where the barrier height is different between the two electrondes - e.g. where the electrodes are composed of different materials. diff --git a/doc/UserGuide/datafile.rst b/doc/UserGuide/datafile.rst index 471501d48..129989459 100755 --- a/doc/UserGuide/datafile.rst +++ b/doc/UserGuide/datafile.rst @@ -199,7 +199,7 @@ The data mask can be accessed via the :py:attr:`Data.mask` attribute of :py:clas print d.mask d.mask=False d.mask=ma.nomask - d.mask=numpy.array([[True, True, Fale,...False],...,[False,True,...True]]) + d.mask=numpy.array([[True, True, False,...False],...,[False,True,...True]]) d.mask=lambda x: x[0]<50 d.mask=lambda x:[y<50 for y in x] @@ -250,7 +250,7 @@ Setting Column Types To set which columns contain 'x','y' etc data use the :py:attr:`Data.setas` attribute. This attribute can take a list of single character strings from the set 'x','y','z','d','e', 'f', 'u', 'v', 'w' or '.' where each element of the list refers to the columns of data in order. To specify that a column has unmarked data use the '.' string. The string '-' can also be used - this -indicats that the current assignment is to be left as is. +indicates that the current assignment is to be left as is. Alternately, you can pass :py:attr:`Data.setas` a string. In the simplest case, the string is just read in the same way that the list would have been - each character corresponds to one column. However, if the string contains an integer, then the next diff --git a/doc/UserGuide/datafolder.rst b/doc/UserGuide/datafolder.rst index 02c9d675a..25ee77de1 100755 --- a/doc/UserGuide/datafolder.rst +++ b/doc/UserGuide/datafolder.rst @@ -26,7 +26,7 @@ Their are further variants that can work with compressed zip archives - :py:clas Finally, for the case of image files, there is a specialised :py:class:`Stoner.Image.ImageStack` class that is optimised for image files of the same dimension and stores the images in a single 3D numpy array to allow much faster operations (at the expense of taking more RAM). -In the documentation below, expcet where noted explicitly, you can use a :py:class:`Stoner.Image.ImageFolder` in place of the :py:class:`DataFolder`, but working +In the documentation below, except where noted explicitly, you can use a :py:class:`Stoner.Image.ImageFolder` in place of the :py:class:`DataFolder`, but working with :py:class:`Stoner.Image.ImageFile` instead of :py:class:`Stoner.Data`. Basic Operations @@ -322,7 +322,7 @@ The various subfolder are stored in a dictionary in the :py:attr:`DataFolder.gro Both the files and groups in a :py:class:`DataFolder` can be accessed either by integer index or by name. If a string name is used and doesn't exactly match, then it is interpreted as a regular expression and that is matched instead. This only applies for retrieving -tiems - for setting items an exact name or integer index is required. +items - for setting items an exact name or integer index is required. Doing Something With Each File @@ -462,7 +462,7 @@ of )oif *values_only* is True, just a list, but the *output* parameter can chang return a list of dictionary subsets of the metadata - "list" or list (the default if *values_only* is True) - return a list of values of each item pf the metadata. If only item of metadata is requested, then just rturns a list. + return a list of values of each item pf the metadata. If only item of metadata is requested, then just returns a list. - "array" or np.array return a single array - like list above, but returns as a numpy array. This can create a 2D array from multiple keys @@ -672,7 +672,7 @@ the topmost group to the lowest (terminal) group. The *replace_terminal* parameter applies when *group* is **True** and the function returns a :py:class:`Stoner.Core,DataFile` object. This indicates that the group on which the function was -called should be removed from the list fo groups and the returned :py:class:`Stoner.Data` +called should be removed from the list of groups and the returned :py:class:`Stoner.Data` object should be added to the list of files in the folder. This operation is useful when one is processing a group of files to combined them into a single dataset. Combining a multi-level grouping operation and successive calls to :py:meth:`DataFolder.walk_groups` can rapidly reduce a large set of diff --git a/doc/UserGuide/developer.rst b/doc/UserGuide/developer.rst index 62c33e7c0..b3850f461 100755 --- a/doc/UserGuide/developer.rst +++ b/doc/UserGuide/developer.rst @@ -93,7 +93,7 @@ will match the expected filenames for this format:: self.patterns=["*.txt","*/dat","*/qda"] -Any custome data class **should** try to identify if the file is the correct format and if so it **must** raise a +Any custom data class **should** try to identify if the file is the correct format and if so it **must** raise a :py:class:`StonerLoadError` exception in order that the autoloading code will known to try a different subclass of :py:class:`DataFile`. If you need to write any additional methods please make sure that they have Google code-style document diff --git a/doc/UserGuide/image.rst b/doc/UserGuide/image.rst index 8ee4c48ef..e98481a39 100755 --- a/doc/UserGuide/image.rst +++ b/doc/UserGuide/image.rst @@ -172,7 +172,7 @@ working box can be given as follows: the None value substitutes for the left, right top or bottom coordinate). - A single string: The argument is interpreted as the name of a metadata item that will define the box to be used. - - A sigle value False: + - A single value False: This is equivalent to the whole image (i.e. to not specify a box) - A single None value: In this case a copy of the image is shown to the user and they are invited to draw the box with the mouse and @@ -273,7 +273,7 @@ can result.:: .. image:: figures/kermit-fft.png -In this example, a copy of the image is transformed to the mangitude of its fourier transform. THe fourier transform is shifted +In this example, a copy of the image is transformed to the magnitude of its fourier transform. THe fourier transform is shifted so that the central pixels are the 0-ffrequency componennts. The optional keywrod *remove_dc* replaces the 0 frequency data with the mean value of the FFT to avoid a large spike int he FFT from the mean value of the image. The *window* parameter tells the method to multiply the image by the corresponding window function (from scikit-image.filters.window) before calculating the FFT. This diff --git a/doc/UserGuide/plotfile.rst b/doc/UserGuide/plotfile.rst index e9c8c3ff9..22b83c1f9 100755 --- a/doc/UserGuide/plotfile.rst +++ b/doc/UserGuide/plotfile.rst @@ -393,7 +393,7 @@ Handling More than One Column of Y Data ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ By default if :py:meth:`Data.plot_xy` is given more than one column of y data, it will plot all -of the data on a single y-axis scale. If the y data to be plotted is not of a similar order of mangitude +of the data on a single y-axis scale. If the y data to be plotted is not of a similar order of magnitude this can result in a less than helpful plot. .. plot:: samples/common_y_plot.py diff --git a/doc/UserGuide/upgrade.rst b/doc/UserGuide/upgrade.rst index 17248158e..9e4e9bcee 100755 --- a/doc/UserGuide/upgrade.rst +++ b/doc/UserGuide/upgrade.rst @@ -5,7 +5,7 @@ ConvertingScripts from Older Versions of the Stoner Package .. currentmodule:: Stoner THe Stoner package has gradually undergone several changes as additional functions have been added to keep the code base -managable. This document summarizes the main changes from previous versions. +manageable. This document summarizes the main changes from previous versions. Python Version Support ====================== @@ -126,7 +126,7 @@ Stoner.DataFolder/Stoner.ImageFolder changes :py:class:`Stoner.DataFolder` and :py:class:`Stoner.ImageFolder` are essentially similar objects for managing collections of :py:class:`Stoner.Data` ad :py:class:`Stoner.ImageFile` respectively. -Earlier versions of the Stoner package exposed the ability to call methods of the sotred :py:class:`Stoner.Data`/ +Earlier versions of the Stoner package exposed the ability to call methods of the stored :py:class:`Stoner.Data`/ :py:class:`Stoner.ImageFile` instances by calling a correspomnding method directly on the folder object. The problem with this is that if there is a name collision with a method intended to work directly on the Folder, it's not clear what method is being called. To remove this problem, and to make it a little more explicit when accessing a method of the stored instances, the @@ -141,7 +141,7 @@ now becomes:: fldr.each.curve_fit(Linear) One of the frequently required operations is to loop through all the files in a folder and extract some of their metadata -nd build that into a new table. This used to be done something like:: +and build that into a new table. This used to be done something like:: result=Data() for data in fldr: diff --git a/doc/analysis-fitting.rst b/doc/analysis-fitting.rst index ec04a108c..7ba7f8743 100755 --- a/doc/analysis-fitting.rst +++ b/doc/analysis-fitting.rst @@ -9,7 +9,7 @@ functions for use with :py:meth:`Stoner.Data.curve_fit` and :py:class:`lmfit.Mod The latter also support the ability to determine an initial value of the parameters from the Data and so can simplify the fitting code considerably. Many of the models come with an example function. -Generic Modles +Generic Models ^^^^^^^^^^^^^^ .. automodapi:: Stoner.analysis.fitting.models.generic diff --git a/doc/conf.py b/doc/conf.py index 0b0f5b41e..41c9b1d32 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -152,7 +152,7 @@ # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = "Stoner Pacakge API Documentation" +html_title = "Stoner Package API Documentation" # A shorter title for the navigation bar. Default is the same as html_title. html_short_title = "Stoner Package" diff --git a/doc/readme.rst b/doc/readme.rst index 52f61dbfa..296818e5a 100755 --- a/doc/readme.rst +++ b/doc/readme.rst @@ -38,7 +38,7 @@ Getting this Code .. image:: https://i.imgur.com/h4mWwM0.png :target: https://www.youtube.com/watch?v=uZ_yKs11W18 - :alt: Introduction and Installation Guide to Stoner Pythin Package + :alt: Introduction and Installation Guide to Stoner Python Package :width: 320 Anaconda Python is the recommended distribution of python and the conda packages are the preferred packaging system for @@ -48,8 +48,8 @@ be obtained from the `phygbu` channel (although for full functionality, other pa Compatibility -------------- -Version 0.10.x is compatbile with Python 3.9-3.13. Version 0.11.x (currently in development) will be compatible with -Python 3.11-3.13 and will add support for 3.14 when it is supported within the Anaconda distrubtion. +Version 0.10.x is compatible with Python 3.9-3.13. Version 0.11.x (currently in development) will be compatible with +Python 3.11-3.13 and will add support for 3.14 when it is supported within the Anaconda distribution. The last version that supported Python 2.7 was 0.9.x @@ -124,7 +124,7 @@ ImageFile --------- **Stoner.ImageFile** is the top-level class for managing image data. It is the equivalent of **Stoner.Data** and maintains -metadta and comes with a number of methods to manipulate image data. The image data is stored internally as a masked numpy +metadata and comes with a number of methods to manipulate image data. The image data is stored internally as a masked numpy array and where possible the masking is taken into account when carrying out image analysis tasks. Through some abuse of the Python class system, functions in the scpy.ndimage and scikit-image modules are mapped into methods of the ImageFile class allowing a very rich set of operations on the data sets. The default IO methods handle tiff and png images and can @@ -137,7 +137,7 @@ DataFolder structure. It provides methods to list. filter and group data according to filename patterns or metadata and then to execute a function on each file or group of files and then collect metadata from each file in turn. A key feature of DataFolder is its ability to work with the collated metadata from the individual files that are held in the DataFolder. -In combination with its ability to walk through a complete heirarchy of groups of +In combination with its ability to walk through a complete hierarchy of groups of **Data** objects, the handling of the common metadata provides powerful tools for quickly writing data reduction scripts. ImageFolder @@ -159,8 +159,8 @@ Other Modules and Classes ------------------------- The **Stoner.HDF5** module provides some additional classes to manipulate *Data* and *DataFolder* objects within HDF5 -format files. HDF5 is a common chouse for storing data from large scale facilties, although providing a way to handle -arbitary HDF5 files is beyond the scope of this package at this time - the format is much too complex and flexible to make that +format files. HDF5 is a common choice for storing data from large scale facilities, although providing a way to handle +arbitrary HDF5 files is beyond the scope of this package at this time - the format is much too complex and flexible to make that an easy task. Rather it provides a way to work with large numbers of experimental sets using just a single file which may be less brutal to your computer's OS than having directory trees with millions of individual files. @@ -227,7 +227,7 @@ Online documentation for all versions can be found on the ReadTheDocs pages `onl Version 0.11 is the current (in development) stable release (i.e. releases pass all unit tests.) New features include: - * Move away from mixin classes and multiple inheritence to dynamically binding functions into the class from + * Move away from mixin classes and multiple inheritance to dynamically binding functions into the class from modules. * Continued restructuring of the class layout and rationalisation of the naming conventions. @@ -242,7 +242,7 @@ Version 0.10 is the old stable release. New Features in 0.10 include: dictionary with methods to prune and filter in the virtual tree of sub-folders. * Refactoring of the **ImageArray** and **ImageFile** so that binding of external functions as methods is done at class definition time rather than at runtime with overly complex __getattr__ methods. The longer term goal is to - depricate the use of ImageArray in favour of just using ImageFile. + deprecate the use of ImageArray in favour of just using ImageFile. * Introduce interactive selection of boxes, lines and mask regions for interactive Matplotlib backends. * Fix some long standing bugs which could lead to shared metadata dictionaries and race conditions @@ -271,7 +271,7 @@ Version 0.8 is the ancient release. The main new features were: 0.8.2 was the final release of the 0.8.0 branch -No further relases will be made to 0.8.x - 0.10.x +No further releases will be made to 0.8.x - 0.10.x Versions 0.7.x and earlier are now pre-historic! diff --git a/doc/samples/stitch.py b/doc/samples/stitch.py index 66d2c9fa2..011988dd9 100755 --- a/doc/samples/stitch.py +++ b/doc/samples/stitch.py @@ -18,7 +18,7 @@ s2.plot(label="Stictched") s2.title = "Stictching Example" -# Tidy up the plot by adding annotation fo the stirching co-efficients +# Tidy up the plot by adding annotation for the stitching co-efficients labels = ["A", "B", "C"] txt = [] lead = r"$x'\rightarrow x+A$" + "\n" + r"$y'=\rightarrow By+C$" + "\n" diff --git a/doc/samples/stitch_int_overlap.py b/doc/samples/stitch_int_overlap.py index 6298fd77d..730a02012 100755 --- a/doc/samples/stitch_int_overlap.py +++ b/doc/samples/stitch_int_overlap.py @@ -23,7 +23,7 @@ s2.plot(fmt="b:", label="Set 2 Stictched on Set 1", linewidth=1) s2.title = "Stictching Example" -# Tidy up the plot by adding annotation fo the stirching co-efficients +# Tidy up the plot by adding annotation for the stitching co-efficients labels = ["A", "B", "C"] txt = []