Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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.

Expand All @@ -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

Expand Down Expand Up @@ -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!

Expand Down
4 changes: 2 additions & 2 deletions Stoner/Image/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Stoner/Image/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions Stoner/Image/imagefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Stoner/Image/kerr.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,15 @@ 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):
last image in stack is closest to saturation
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:
Expand Down
10 changes: 5 additions & 5 deletions Stoner/Image/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,)))
Expand Down
22 changes: 11 additions & 11 deletions Stoner/analysis/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions Stoner/analysis/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Stoner/analysis/fitting/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading
Loading