Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/RELEASE_next_minor' into RELEA…
Browse files Browse the repository at this point in the history
…SE_v1.1
  • Loading branch information
francisco-dlp committed Aug 2, 2016
2 parents 9e80963 + d59105d commit f90b911
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 216 deletions.
61 changes: 30 additions & 31 deletions doc/citing.rst
Expand Up @@ -8,37 +8,36 @@ entry

.. code-block:: bibtex
@misc{francisco_de_la_pena_2015_27735,
author = {Francisco de la Peña and
Vidar Tonaas Fauske and
Pierre Burdet and
Tomas Ostasevicius and
Mike Sarahan and
Magnus Nord and
Joshua A. Taillon and
Duncan Johnstone and
Katherine E. MacArthur and
Alberto Eljarrat and
Stefano Mazzucco and
Jan Caron and
Tom Furnival and
Michael Walls and
Eric Prestat and
Gaël Donval and
Ben Martineau and
Luiz Fernando Zagonel and
Petras Jokubauskas and
Thomas Aarholt and
and Andreas Garmannslund and
Ilya Iyengar and
},
title = {hyperspy: HyperSpy 0.8.5},
month = jun,
year = 2016,
doi = {10.5281/zenodo.58841},
url = {http://dx.doi.org/10.5281/zenodo.58841}
}
@misc{francisco_de_la_pena_2016_58841,
author = {Francisco de la Peña and
Tomas Ostasevicius and
Vidar Tonaas Fauske and
Pierre Burdet and
Petras Jokubauskas and
Mike Sarahan and
Duncan Johnstone and
Magnus Nord and
Josh Taillon and
Jan Caron and
Katherine E. MacArthur and
Alberto Eljarrat and
Stefano Mazzucco and
Tom Furnival and
Eric Prestat and
Michael Walls and
Gaël Donval and
Ben Martineau and
Luiz Fernando Zagonel and
Andreas Garmannslund and
Thomas Aarholt and
Christoph Gohlke and
Ilya Iyengar},
title = {hyperspy: HyperSpy 1.0.1},
month = jul,
year = 2016,
doi = {10.5281/zenodo.58841},
url = {http://dx.doi.org/10.5281/zenodo.58841}
}
or click on the DOI badge below for more citation formats.

Expand Down
9 changes: 9 additions & 0 deletions hyperspy/_components/eels_cl_edge.py
Expand Up @@ -306,6 +306,15 @@ def function(self, E):
"""Returns the number of counts in barns
"""
shift = self.onset_energy.value - self.GOS.onset_energy
if shift != self.GOS.energy_shift:
# Because hspy Events are not executed in any given order,
# an external function could be in the same event execution list
# as _integrate_GOS and be executed first. That can potentially
# cause an error that enforcing _integrate_GOS here prevents. Note
# that this is suboptimal because _integrate_GOS is computed twice
# unnecessarily.
self._integrate_GOS()
Emax = self.GOS.energy_axis[-1] + self.GOS.energy_shift
cts = np.zeros((len(E)))
bsignal = (E >= self.onset_energy.value)
Expand Down
42 changes: 22 additions & 20 deletions hyperspy/_signals/eels.py
Expand Up @@ -170,12 +170,11 @@ def estimate_zero_loss_peak_centre(self, mask=None):
self._check_signal_dimension_equals_one()
self._check_navigation_mask(mask)
zlpc = self.valuemax(-1)
if self.axes_manager.navigation_dimension == 1:
zlpc = zlpc.as_signal1D(0)
elif self.axes_manager.navigation_dimension > 1:
zlpc = zlpc.as_signal2D((0, 1))
if mask is not None:
zlpc.data[mask.data] = np.nan
zlpc.set_signal_type("")
title = self.metadata.General.title
zlpc.metadata.General.title = "ZLP(%s)" % title
return zlpc

def align_zero_loss_peak(
Expand Down Expand Up @@ -337,20 +336,22 @@ def estimate_elastic_scattering_intensity(
if isinstance(threshold, numbers.Number):
I0 = self.isig[:threshold].integrate1D(-1)
else:
I0 = self._get_navigation_signal().transpose(signal_axes=0)
for i, s in progressbar(enumerate(self),
total=self.axes_manager.navigation_size,
disable=not show_progressbar,
leave=True):
threshold_ = threshold.isig[I0.axes_manager.indices].data[0]
if np.isnan(threshold_):
s.data[:] = np.nan
else:
s.data[:] = (self.inav[I0.axes_manager.indices].isig[
:threshold_].integrate1D(-1).data)
I0 = I0.transpose(signal_axes=self.axes_manager.navigation_dimension)
I0 = self._get_navigation_signal()
I0.axes_manager.set_signal_dimension(0)
with progressbar(total=self.axes_manager.navigation_size,
disable=not show_progressbar,
leave=True) as pbar:
for i, (i0, th, s) in enumerate(zip(I0._iterate_signal(),
threshold._iterate_signal(),
self)):
if np.isnan(th[0]):
i0[:] = np.nan
else:
i0[:] = s.isig[:th[0]].integrate1D(-1).data
pbar.update(1)
I0.metadata.General.title = (
self.metadata.General.title + ' elastic intensity')
I0.set_signal_type("")
if self.tmp_parameters.has_item('filename'):
I0.tmp_parameters.filename = (
self.tmp_parameters.filename +
Expand Down Expand Up @@ -461,16 +462,15 @@ def estimate_elastic_scattering_threshold(self,
# Create spectrum image, stop and return value
threshold.metadata.General.title = (
self.metadata.General.title +
' ZLP threshold')
' elastic scattering threshold')
if self.tmp_parameters.has_item('filename'):
threshold.tmp_parameters.filename = (
self.tmp_parameters.filename +
'_ZLP_threshold')
'_elastic_scattering_threshold')
threshold.tmp_parameters.folder = self.tmp_parameters.folder
threshold.tmp_parameters.extension = \
self.tmp_parameters.extension
threshold = threshold.transpose(signal_axes=min(
2, self.axes_manager.navigation_dimension))
threshold.set_signal_type("")
return threshold

def estimate_thickness(self,
Expand Down Expand Up @@ -532,6 +532,8 @@ def estimate_thickness(self,
s.tmp_parameters.folder = self.tmp_parameters.folder
s.tmp_parameters.extension = \
self.tmp_parameters.extension
s.axes_manager.set_signal_dimension(0)
s.set_signal_type("")
return s

def fourier_log_deconvolution(self,
Expand Down
3 changes: 3 additions & 0 deletions hyperspy/_signals/signal1d.py
Expand Up @@ -1221,6 +1221,9 @@ def estimate_peak_width(self,
right.metadata.General.title = (
self.metadata.General.title +
" full-width at %.1f maximum right position" % factor)
for signal in (left, width, right):
signal.axes_manager.set_signal_dimension(0)
signal.set_signal_type("")
if return_interval is True:
return [width, left, right]
else:
Expand Down
47 changes: 4 additions & 43 deletions hyperspy/axes.py
Expand Up @@ -28,7 +28,6 @@
from hyperspy.misc.math_tools import isfloat

import warnings
from hyperspy.exceptions import VisibleDeprecationWarning


class ndindex_nat(np.ndindex):
Expand Down Expand Up @@ -312,22 +311,6 @@ def __repr__(self):
def __str__(self):
return self._get_name() + " axis"

def connect(self, f):
warnings.warn(
"The method `DataAxis.connect()` has been deprecated and will "
"be removed in HyperSpy 0.10. Please use "
"`DataAxis.events.value_changed.connect()` instead.",
VisibleDeprecationWarning)
self.events.value_changed.connect(f, [])

def disconnect(self, f):
warnings.warn(
"The method `DataAxis.disconnect()` has been deprecated and "
"will be removed in HyperSpy 0.10. Please use "
"`DataAxis.events.indices_changed.disconnect()` instead.",
VisibleDeprecationWarning)
self.events.value_changed.disconnect(f)

def update_index_bounds(self):
self.high_index = self.size - 1

Expand Down Expand Up @@ -406,14 +389,6 @@ def value2index(self, value, rounding=round):
else:
raise ValueError("The value is out of the axis limits")

def set_index_from_value(self, value):
warnings.warn(
"The method `DataAxis.set_index_from_value()` has been deprecated "
"and will be removed in HyperSpy 0.10. Please set the value using "
"the `value` attribute and the index will update automatically.",
VisibleDeprecationWarning)
self.value = value

def index2value(self, index):
if isinstance(index, np.ndarray):
return self.axis[index.ravel()].reshape(index.shape)
Expand Down Expand Up @@ -861,7 +836,7 @@ def update_axes_attributes_from(self, axes,
self.events.any_axis_changed.trigger(obj=self)

def _update_attributes(self):
getitem_tuple = ()
getitem_tuple = []
values = []
self.signal_axes = ()
self.navigation_axes = ()
Expand All @@ -876,10 +851,12 @@ def _update_attributes(self):
else:
getitem_tuple += axis.slice,
self.signal_axes += axis,
if not self.signal_axes and self.navigation_axes:
getitem_tuple[-1] = slice(axis.index, axis.index + 1)

self.signal_axes = self.signal_axes[::-1]
self.navigation_axes = self.navigation_axes[::-1]
self._getitem_tuple = getitem_tuple
self._getitem_tuple = tuple(getitem_tuple)
self.signal_dimension = len(self.signal_axes)
self.navigation_dimension = len(self.navigation_axes)
if self.navigation_dimension != 0:
Expand Down Expand Up @@ -929,22 +906,6 @@ def set_signal_dimension(self, value):
for axis in self._axes:
axis.navigate = tl.pop(0)

def connect(self, f):
warnings.warn(
"The method `AxesManager.connect()` has been deprecated and will "
"be removed in HyperSpy 0.10. Please use "
"`AxesManager.events.indices_changed.connect()` instead.",
VisibleDeprecationWarning)
self.events.indices_changed.connect(f, [])

def disconnect(self, f):
warnings.warn(
"The method `AxesManager.disconnect()` has been deprecated and "
"will be removed in HyperSpy 0.10. Please use "
"`AxesManager.events.indices_changed.disconnect()` instead.",
VisibleDeprecationWarning)
self.events.indices_changed.disconnect(f)

def key_navigator(self, event):
if len(self.navigation_axes) not in (1, 2):
return
Expand Down
33 changes: 0 additions & 33 deletions hyperspy/component.py
Expand Up @@ -33,7 +33,6 @@
from hyperspy.misc.export_dictionary import export_to_dictionary, \
load_from_dictionary
from hyperspy.events import Events, Event
from hyperspy.exceptions import VisibleDeprecationWarning

import logging

Expand Down Expand Up @@ -200,22 +199,6 @@ def __repr__(self):
def __len__(self):
return self._number_of_elements

def connect(self, f):
warnings.warn(
"The method `Parameter.connect()` has been deprecated and will be "
"removed in HyperSpy 0.10. Please use "
"`Parameter.events.value_changed.connect()` instead.",
VisibleDeprecationWarning)
self.events.value_changed.connect(f, [])

def disconnect(self, f):
warnings.warn(
"The method `Parameter.disconnect()` has been deprecated and will "
"be removed in HyperSpy 0.10. Please use "
"`Parameter.events.value_changed.disconnect()` instead.",
VisibleDeprecationWarning)
self.events.value_changed.disconnect(f)

def _get_value(self):
if self.twin is None:
return self.__value
Expand Down Expand Up @@ -839,22 +822,6 @@ def _axes_manager(self, value):
parameter._axes_manager = value
self.__axes_manager = value

def connect(self, f):
warnings.warn(
"The method `Component.connect()` has been deprecated and will be "
"removed in HyperSpy 0.10. Please use "
"`Component.events.active_changed.connect()` instead.",
VisibleDeprecationWarning)
self.events.active_changed.connect(f, [])

def disconnect(self, f):
warnings.warn(
"The method `Component.disconnect()` has been deprecated and will "
"be removed in HyperSpy 0.10. Please use "
"`Component.events.active_changed.disconnect()` instead.",
VisibleDeprecationWarning)
self.events.active_changed.disconnect(f)

def _get_active(self):
if self.active_is_multidimensional is True:
# The following should set
Expand Down
62 changes: 0 additions & 62 deletions hyperspy/messages.py

This file was deleted.

3 changes: 2 additions & 1 deletion hyperspy/misc/slicing.py
Expand Up @@ -208,7 +208,8 @@ def _get_array_slices(self, slices, isNavigation=None):
def _slicer(self, slices, isNavigation=None, out=None):
array_slices = self._get_array_slices(slices, isNavigation)
if out is None:
_obj = self._deepcopy_with_new_data(self.data[array_slices])
_obj = self._deepcopy_with_new_data(self.data[array_slices],
copy_variance=True)
_to_remove = []
for slice_, axis in zip(array_slices, _obj.axes_manager._axes):
if (isinstance(slice_, slice) or
Expand Down

0 comments on commit f90b911

Please sign in to comment.